我正在使用以下脚本从我的留言簿中清除垃圾邮件链接,如果我将查询复制并传递到 phpmyadmin 它工作得很好,如果我在保存为 php 文件的浏览器中运行以下脚本,我会收到错误“不能执行查询:”。我已经看过了,看不到 iv 做错了什么,谁能看到任何明显的 iv 遗漏?
<?php
// Checks to see if the key value is set
if (isset($_GET['key'])) {
$key = $_GET['key'];
}
// If the key value isnt set give it a value of nothing
else
{$key = '';}
// Checks to see if the key value is valid to authenticate the user
if ($key == 'keycode'){
// If the key value is correct the user is granted access
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Select mysql db
mysql_select_db("towerroa_TRA", $con);
mysqli_query($con, "DELETE FROM `itsnb_phocaguestbook_items` WHERE `content` LIKE '%<a%'")or die ("Couldn't execute query: ".mysqli_error());
echo 'Spam Purged !';
}
else {
// Denies the user access if the key value isnt correct
echo '<h1>Access Denied !</h1>';}