Luno1599
02-10-2009, 08:28 AM
Hey,
I am designing a script and I want the users to need a license to run the script. Its a free script but I just want a quck and easy way for me to track usage.
I have made a script but I cant get the dam thing to work.
Here is thats is built into the script
$check_license = get_file_contant(http://URL/license.php?license=check&url=http://www.roizer.com&license=ipvdD563YjhPeS8);
Here is whats in the license file on my server:
if($_GET['license'] == "check"){
$url = $_GET['url'];
$license = $_GET['license'];
/* Setup MySQL Access */
$DBhost = "localhost";
$DBuser = "";
$DBpass = "";
$DBname = "";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Cannot connect to database server");
mysql_select_db($DBname) or die ("Cannot select site database");
$date = date("d-m-Y");
$license_query = mysql_query("SELECT * FROM `license` WHERE `key` = '$key'");
$license_row = mysql_fetch_array($license_query);
$dbexpires = $license_row['expires'];
$dburl = $license_row['url'];
$dbkey = $license_row['key'];
echo "$dbkey" . "<br>" . "$dburl" . "<br>" . "$dbexpires";
if($dbkey != $license){
echo "Error No License";
return "3";
}else
if($dburl != $url){
echo "URL Wrong!";
return "4";
}else
if($date >= $dbexpires){
echo "EXPIRED";
return "5";
}else
return "6";
}
(this is just a test script but I cant get it to work, if the domain is wrong it echos wrong license and if the license if wrong it still echos wrong license and if the license in the db expirery date is less then the date today it still says no license and will not work for anything!! Help!
Dan
I am designing a script and I want the users to need a license to run the script. Its a free script but I just want a quck and easy way for me to track usage.
I have made a script but I cant get the dam thing to work.
Here is thats is built into the script
$check_license = get_file_contant(http://URL/license.php?license=check&url=http://www.roizer.com&license=ipvdD563YjhPeS8);
Here is whats in the license file on my server:
if($_GET['license'] == "check"){
$url = $_GET['url'];
$license = $_GET['license'];
/* Setup MySQL Access */
$DBhost = "localhost";
$DBuser = "";
$DBpass = "";
$DBname = "";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Cannot connect to database server");
mysql_select_db($DBname) or die ("Cannot select site database");
$date = date("d-m-Y");
$license_query = mysql_query("SELECT * FROM `license` WHERE `key` = '$key'");
$license_row = mysql_fetch_array($license_query);
$dbexpires = $license_row['expires'];
$dburl = $license_row['url'];
$dbkey = $license_row['key'];
echo "$dbkey" . "<br>" . "$dburl" . "<br>" . "$dbexpires";
if($dbkey != $license){
echo "Error No License";
return "3";
}else
if($dburl != $url){
echo "URL Wrong!";
return "4";
}else
if($date >= $dbexpires){
echo "EXPIRED";
return "5";
}else
return "6";
}
(this is just a test script but I cant get it to work, if the domain is wrong it echos wrong license and if the license if wrong it still echos wrong license and if the license in the db expirery date is less then the date today it still says no license and will not work for anything!! Help!
Dan