Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there

i am currently trying to implement and play around with a licencing system with my php code and found a licence system on github

when i run the client side php code i get a foreach error on line 16 and was wondering if someone could tell me exactly where it is wrong please its probably something so simple but any help would be great

the code is

PHP
define( "LICENSE_KEY", "000-0000-0000-0000" );

if( !( ini_get(allow_url_fopen) ) ) exit('Configuration Error: allow_url_fopen must be enabled on your server for this script to work');
    
    define( "LICENSE_SERV", "https://licencing.domain.com/check.php?key=" );

    $LICENSE_SERV=LICENSE_SERV;
    $LICENSE_KEY=LICENSE_KEY;
    $licserv = "$LICENSE_SERV$LICENSE_KEY";
    $lines = @file($licserv);

    foreach($lines as $line){
    $license = htmlspecialchars($line);
    
    if ($license == "INVALID") { 
   exit("Invalid License Key"); 
   } 
   
}

foreach($lines as $line){ is where the apparent error is occurring

any help would be greatly appreciated

Thanks

Chris.

What I have tried:

multiple variations and also online google searches and tried fixing this my self
Posted
Updated 30-Apr-22 21:24pm
v2
Comments
Patrice T 30-Apr-22 18:43pm    
And you plan to tell us the error message ?
Richard MacCutchan 1-May-22 3:25am    
At a guess, the variable $lines does not contain anything. Use the debugger to check.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900