0

我正在尝试为我的简单 CMS 脚本创建一个许可证系统,并且我正在使用 fopen 函数来执行此操作,但我遇到了错误。这是我的 html 表单的代码:

<form action="check.php" method="post">
<div><label id="Label1" for="domain">Domain : </label><input name="domain" type="text" /></div>
<div><label id="Label2" for="lis">Liscence : </label><input name="liscode" type="text" /></div>
<div><input name="Submit1" type="submit" value="submit" /></div>
</form>

对于表单操作:

<?php
$dom = $_POST['domain'];
$lis = $_POST['liscode'];
$URL = "http://localhost/check/checklic.php?dom=".$dom."&lis=".$lis."";
$handle = fopen($URL, "r");
if ($accept = 0){
$letter = "Invalid License Key";
}
else
{
$letter = " Congratulation You Have Been License";
}
echo $letter;
?>

我的文件用我的数据库检查许可证是:

<?php
$domain = $_GET['dom'];
$liskey = $_GET['lis'];
$host = "localhost";
$user = "root";
$pass = "admin";
$db = "test";
$dblink = new PDO("mysql:host=$host;dbname=$db",$user,$pass);
$mysql_liscode = "SELECT liscode FROM lis WHERE domain = '".$domain."'";
$query_liscode = $dblink->query($mysql_liscode) or die("failed!");
$liscode = $query_liscode->fetch(PDO::FETCH_ASSOC);
$count = $query_liscode->rowCount();
if ($count = 0){
$accept = 0;
}
elseif ($liscode['liscode'] != $liskey){
$accept = 0;
}
else{
$accept = 1;
}
?>

请注意,许可证检查器位于

http://localhost/check

而具有其作用的形式在

http://localhost/site

信息永远存在

Warning: fopen(http://localhost/check/checklic.php?dom=ammar.com&lis=1234) [function.fopen]:
failed to open stream: No error in C:\AppServ\www\site\check.php on line 5
Congratulation You Have Been Liscienced

即使我在表格中插入了错误的许可证信息

请提供任何帮助。

4

2 回答 2

0

更改if ($accept = 0){if ($accept == 0){和相同的$count

于 2013-02-09T13:45:26.057 回答
0

我要在这里大吃一惊,并建议问题出在网址上,

试试看

$URL = "http://localhost/check/checklic.php?dom=".$dom."&lis=".$lis;
$handle = @fopen($URL, "r");
于 2013-02-09T14:03:04.153 回答