0
我試圖爲我的簡單CMS腳本創建許可證系統,並且我使用fopen函數來執行此操作,但出現錯誤。 這裏是我的代碼爲我的HTML表單:PHP打開並傳遞變量以獲取變量值
<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
即使我在形式插入錯誤的許可證信息
任何幫助請。
問題不是在結果中的問題是,變量不能通過我改變了ID並得到了相同的結果,警告仍然是相同的 – 2013-02-09 13:49:21