有人可以告诉这里出了什么问题吗?
我的用户名是:系统
在我的收件箱中,我有 2 条消息。1 个被发送到System,另一个被发送到system。
我可以删除系统邮件,但是当我尝试删除系统邮件时,我的代码中出现了“不是您的邮件”错误。
这是查看消息页面中的删除代码:
$delmsg=$_GET['delete'];
$idcheck = mysql_query("SELECT * FROM `inbox` WHERE `id`='$delmsg'");
$idfetch = mysql_fetch_object($idcheck);
if ($delmsg !=''){
if ($idfetch->to != $username){
$errormsg = "Error - This is not your message to delete. Returning to your inbox... ";
echo "<meta http-equiv=Refresh content=1;url=messages.php>";
}else{
mysql_query("DELETE FROM `inbox` WHERE `to`='$username' AND `id`='$delmsg'");
$errormsg = "Message deleted. Returning to your inbox...";
echo "<meta http-equiv=Refresh content=1;url=messages.php>";
}
}
这是发送消息页面中的代码:
if(strip_tags($_POST['send'])){
$recipient= $_POST['sendto'];
$subjectmsg= $_POST['subject'];
$msgfull= $_POST['messagetext'];
$date = date('Y-m-d H:i:s');
if (!$recipient){
$errormsg=" You must enter a recipient or your recipient's username must contain 3 or more characters. ";
}elseif ($msgfull =="" || !msgfull){
$errormsg="You cannot send a blank message. Please type your message in the text area above.";
}elseif ($recipient && $msgfull){
$checker=mysql_query("SELECT * FROM `user` WHERE `username`='$recipient'");
$checkrows=mysql_num_rows($checker);
if ($checkrows =="0"){
$errormsg="User does not exist. Please check your SEND TO field";
}elseif (!$subjectmsg){
mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `message`, `date`, `read`, `saved`, `subject`) VALUES
('', '$recipient', '$username', '$msgfull', '$date', '0', '0', 'No Subject')");
echo "<meta http-equiv=Refresh content=0;url=messages.php>";
}else{
mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `message`, `date`, `read`, `saved`, `subject`) VALUES
('', '$recipient', '$username', '$msgfull', '$date', '0', '0', '$subjectmsg')");
echo "<meta http-equiv=Refresh content=0;url=messages.php>";
}}
}
USER 表中的 'username' 和 INBOX 表中的 'to' 都设置为 latin, varchar(255) 如果有帮助的话。