Line 1
Line 2
It comes out:
Line 1 Line 2
I have looked at the code over and over and I'm probably over looking the obvious. Could someone look at my code and tell me what I am over looking? Below is the code for the 2 files I use for the message system.
pms.php
Code: Select all
<?
include 'header.php';
if ($_GET['delete'] != ""){
$deletemsg = $_GET['delete'];
$result = mysql_query("DELETE FROM `pms` WHERE `id`='".$deletemsg."'");
echo Message("Message Deleted!");
}
if ($_GET['deleteall'] == "true"){
$result = mysql_query("DELETE FROM `pms` WHERE `to`='".$user_class->username."'");
echo Message("Message Deleted!");
}
if ($_POST['newmessage'] != ""){
$to = $_POST['to'];
$from = $user_class->id;
$timesent = time();
$subject = strip_tags($_POST['subject']);
$msgtext = strip_tags($_POST['msgtext']);
$checkuser = mysql_query("SELECT `username` FROM `grpgusers` WHERE `username`='".$to."'");
$username_exist = mysql_num_rows($checkuser);
if($username_exist > 0){
$result= mysql_query("INSERT INTO `pms` (`to`, `from`, `timesent`, `subject`, `msgtext`)".
"VALUES ('$to', '$from', '$timesent', '$subject', '$msgtext')");
echo Message("Message successfully sent to $to");
} else {
echo Message('I am sorry but the Username you specified does not exist...');
}
}
?>
<tr><td class="contenthead">Mailbox</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
<tr>
<td colspan='25%'>Time Recieved</td>
<td width='25%'>Subject</td>
<td width='25%'>From</td>
<td width='25%'>Viewed</td>
<td>Delete</td>
</tr>
<?
$result = mysql_query("SELECT * from `pms` ORDER BY `timesent` DESC");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if (strtoupper($row['to']) == strtoupper($user_class->username)) {
$from_user_class = new User($row['from']);
$subject = ($row['subject'] == "") ? "No Subject" : $row['subject'];
if ($row['viewed']=="1"){
$viewed="No";
}else{
$viewed="Yes";
}
echo "
<tr>
<td colspan='25%'>".date(F." ".d.", ".Y." ".g.":".i.":".sa,$row['timesent'])."</td>
<td width='25%'><a href='viewpm.php?id=".$row['id']."'>".$subject."</a></td>
<td width='25%'>".$from_user_class->formattedname."</td>
<td width='25%'>".$viewed."</td>
<td><a href='pms.php?delete=".$row['id']."'>Delete</a></td>
</tr>
";
}
}
if ($_GET['reply'] != ""){
$result2 = mysql_query("SELECT * from `pms` WHERE `id`='".$_GET['reply']."'");
$worked2 = mysql_fetch_array($result2);
$from_user_class = new User($worked2['from']);
}
?>
<br /><center><a href='pms.php?deleteall=true'>Delete All PMs In Your Inbox</a></center>
</table>
</td></tr>
<tr><td class="contenthead">New Message</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
<form method='post'>
<tr>
<td width='15%'>Send To:</td>
<td width='85%'><input type='text' name='to' value='' size='10' maxlength='75'> [username]
</tr>
<tr>
<td width='15%'>Subject:</td>
<td width='85%'><input type='text' name='subject' size='70' maxlength='75' value='<? echo ($_GET['reply'] != "") ? "Re: ".$worked2['subject'] : ""; ?>'></td>
</tr>
<tr>
<td width='15%'>Message:</td>
<td width='85%' colspan='3'><textarea name='msgtext' cols='53' rows='7'></textarea></td>
</tr>
<tr>
<td width='100%' colspan='4' align='center'><input type='submit' name='newmessage' value='Send'></td>
</tr>
</form>
</table>
</td></tr>
<?
include 'footer.php';
?>Code: Select all
<?
include 'header.php';
?>
<tr><td class="contenthead">Mailbox</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
<?
$result = mysql_query("SELECT * from `pms` WHERE `id`='".$_GET['id']."'");
$row = mysql_fetch_array($result);
$from_user_class = new User($row['from']);
if ($_GET['id'] != ""){
if (strtoupper($row['to']) == strtoupper($user_class->username)) {
echo "
<tr>
<td width='15%'>Subject:</td>
<td width='45%'>".$row['subject']."</td>
<td width='15%'>Sender:</td>
<td width='25%'>".$from_user_class->formattedname."</td>
</tr>
<tr>
<td>Recieved:</td>
<td colspan='3'>".date(F." ".d.", ".Y." ".g.":".i.":".sa,$row['timesent'])."</td>
</tr>
<tr>
<td class='textm'>Message:<br>".wordwrap($row['msgtext'])."
</td>
</tr>
<tr>
<td colspan='4' align='center'><a href='pms.php?delete=".$row['id']."'>Delete</a> | <a href='pmsreply.php?reply=".$row['id']."'>Reply</a></td>
</tr>
<tr>
<td colspan='4' align='center'><a href='pms.php'>Back To Mailbox</a></td>
</tr>
";
$result2 = mysql_query("UPDATE `pms` SET `viewed` = '2' WHERE `id`='".$row['id']."'");
}
}
?>
</table>
</td></tr>
<?
include 'footer.php';
?>