<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."\n");
die();
}
?>
</body>
</html>
出于某种原因,此脚本将始终输出“您的许可证密钥正确!做得好。”即使许可证密钥错误。我不知道我在这里做错了什么;它应该工作。基本上我正在尝试使用适当的参数使PHP脚本在Iframe中运行此脚本。 psh
并不重要,但key
是用户在通过IFrame发送请求的PHP脚本配置中输入的许可证密钥等。
包含IFrame的PHP脚本看起来像这样......
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>";
我很确定所有这些都是正确的,它不会输出正确的东西。
答案 0 :(得分:2)
if($lko = TRUE) {
使用条件评估为true进行赋值。
请改用比较:if($lko == TRUE) {