<html>
<head>
<title>Online Verification</title>
<style>
body {
font-family: "trebuchet ms", arial, verdana;
}
</style>
</head>
<body>
<?php
# Key array
$lks = array("0c8d3290675d6cf652ef70486d707090", "5eb059442ee03e9721ef3bb00d670020" , "a3d96258be778b21558b5c2222accea2", "3af88a65b1326db94fad0e4b66f7b556");
# Log file
$log = 'log.txt';
# Get IP
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
# Set missing vars
if(!isset($_GET["key"])) {$_GET["key"] = "248f824yf";}
if($_GET["key"] == "") {$_GET["key"] = "482fh3748fh";}
if(!isset($_GET["vn"])) {$_GET["vn"] = "";}
if(!isset($_GET["psh"])) {$_GET["psh"] = "";}
if(!isset($_GET["a"])) {$_GET["a"] = "";}
# Shorten GET vars
$lk = $_GET["key"];
$vn = $_GET["vn"];
$cb = $_GET["psh"];
$a = $_GET["a"];
# Check key to see if it is blank, correct or wrong.
if(in_array(md5($lk), $lks)) {
$lko = TRUE;
} else {
$lko = FALSE;
}
# Correct
if($lko = TRUE) {
die("<span style='color: green;'><b>Your license key is correct! Well done.</b></span>");
}
# Incorrect
if($lko = FALSE) {
echo "<span style='color: red;'><b>Your license key was invalid or you have not yet purchased this product. Please do so for more features!</b></span>";
if(!file_exists($log)) {
# Create file if it doesn't exist
$handle = fopen($log, 'w') or die('Cannot open file: '.$log); //implicitly creates file
fclose($handle);
}
# Add key, version number, IP and website address to file
file_put_contents($log, "Key: ".$lk." | User IP: ".$ip." | Version: ".$vn." | Website Addr: ".$a."
");
die();
}
?>
</body>
</html>
For some reason, this script will always output "Your license key is correct! Well done." even if the license key is wrong. I don't see what I'm doing wrong here; it should work. Basically I'm trying to make a PHP script run this script in an Iframe, with proper arguments. psh
isn't really important but key
is the License Key the user inputted in the configurations of the PHP script that sends the request through the IFrame and so on.
The PHP script containing the IFrame looks like this...
echo "<iframe height='70px' width='700px' src='http://marksrtz.site50.net/prl/main.php?key=".urlencode($license_key)."&vn=".urlencode($version)."&a=".urlencode($_SERVER['HTTP_HOST)."'></iframe>";
I'm pretty sure all of this is correct, it just won't output the right thing.