Case sensitive problems on message system
<p>could someone please advise what is going wrong here?</p>

<p>my username is: System</p>

<p>In my inbox, I have 2 messages. 
1 was sent to <strong>System</strong> and the other was sent to <strong>system</strong>.</p>

<p>I can delete the <strong>System</strong> mail, but when I try to delete the <strong>system</strong> message, 
it gives me the 'not your message' error from my code.</p>

<p>here is the delete code from the view message page:</p>

<pre><code>$delmsg=$_GET['delete'];

$idcheck = mysql_query("SELECT * FROM `inbox` WHERE `id`='$delmsg'");
$idfetch = mysql_fetch_object($idcheck);


    if ($delmsg !=''){
      if ($idfetch-&gt;to != $username){
         $errormsg = "Error - This is not your message to delete. Returning to your inbox... ";
         echo "&lt;meta http-equiv=Refresh content=1;url=messages.php&gt;";
      }else{
mysql_query("DELETE FROM `inbox` WHERE `to`='$username' AND `id`='$delmsg'");
         $errormsg = "Message deleted. Returning to your inbox...";
         echo "&lt;meta http-equiv=Refresh content=1;url=messages.php&gt;";
}
}
</code></pre>

<p>and here is the code from the send a message page:</p>

<pre><code>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 &amp;&amp; $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 "&lt;meta http-equiv=Refresh content=0;url=messages.php&gt;";
    }else{
    mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `message`, `date`, `read`, `saved`, `subject`) VALUES 
                                     ('', '$recipient', '$username', '$msgfull', '$date', '0', '0', '$subjectmsg')");
                                     echo "&lt;meta http-equiv=Refresh content=0;url=messages.php&gt;";
    }}
}
</code></pre>

<p>Both 'username' in the USER table and 'to' in the INBOX table are set to latin, varchar(255)   if that helps.</p>
