$mail[sender] | $mail[subject] | - Read";
}
print "";
print " [Clear Inbox][Compose]";
if ($step == clear) {
print " Mail cleared. (refresh)";
mysql_query("delete from mail where owner=$user[id]");
}
}
if ($view == write) {
print "[Inbox]
";
print "";
if ($step == send) {
if(!$to){
$to=$playa;
}
if (empty ($to) || empty ($body)) {
print "Please fill out all fields.";
include("gamefooter.php");
exit;
}
if (empty ($subject)) {
$subject = "None";
}
$rec = mysql_fetch_array(mysql_query("select * from users where id=$to"));
if (empty ($rec[id])) {
print "No such player.";
include("gamefooter.php");
exit;
}
$body = str_replace("<","",$body);
$body = str_replace(">","",$body);
$body = str_replace("'","'",$body);
$subject = str_replace("'","'",$subject);
$body = str_replace("[back]" , "" , $body);
$body = str_replace("[bigsmile]" , "" , $body);
$body = str_replace("[cry]" , "" , $body);
$body = str_replace("[forward]" , "" , $body);
$body = str_replace("[frown]" , "" , $body);
$body = str_replace("[frustrated]" , "" , $body);
$body = str_replace("[mad]" , "" , $body);
$body = str_replace("[pause]" , "" , $body);
$body = str_replace("[play]" , "" , $body);
$body = str_replace("[smile]" , "" , $body);
$body = str_replace("[stop]" , "" , $body);
$body = str_replace("[suprised]" , "" , $body);
$body = str_replace("[tongue]" , "" , $body);
$body = str_replace("[b]" , "" , $body);
$body = str_replace("[u]" , "" , $body);
$body = str_replace("[i]" , "" , $body);
$body = str_replace("[s]" , "" , $body);
$body = str_replace("[/b]" , "" , $body);
$body = str_replace("[/u]" , "" , $body);
$body = str_replace("[/i]" , "" , $body);
$body = str_replace("[/s]" , "" , $body);
$body = str_replace("[hl]" , "" , $body);
$body = str_replace("[/hl]" , "" , $body);
$subject = str_replace("[back]" , "" , $subject);
$subject = str_replace("[bigsmile]" , "" , $subject);
$subject = str_replace("[cry]" , "" , $subject);
$subject = str_replace("[forward]" , "" , $subject);
$subject = str_replace("[frown]" , "" , $subject);
$subject = str_replace("[frustrated]" , "" , $subject);
$subject = str_replace("[mad]" , "" , $subject);
$subject = str_replace("[pause]" , "" , $subject);
$subject = str_replace("[play]" , "" , $subject);
$subject = str_replace("[smile]" , "" , $subject);
$subject = str_replace("[stop]" , "" , $subject);
$subject = str_replace("[suprised]" , "" , $subject);
$subject = str_replace("[tongue]" , "" , $subject);
$subject = str_replace("[b]" , "" , $subject);
$subject = str_replace("[u]" , "" , $subject);
$subject = str_replace("[i]" , "" , $subject);
$subject = str_replace("[s]" , "" , $subject);
$subject = str_replace("[/b]" , "" , $subject);
$subject = str_replace("[/u]" , "" , $subject);
$subject = str_replace("[/i]" , "" , $subject);
$subject = str_replace("[/s]" , "" , $subject);
$subject = str_replace("[hl]" , "" , $subject);
$subject = str_replace("[/hl]" , "" , $subject);
$body = str_replace("'","'",$body);
$body = str_replace("(C)","©",$body);
$body = str_replace("(c)","©",$body);
$body = str_replace(" "," ",$body);
$body = str_replace("
"," ",$body);
mysql_query("insert into mail (sender,senderid,owner,subject,body) values('$user[username]','$user[id]',$to,'$subject','$body')") or print(" Could not send mail.");
mysql_query("insert into log (owner, log) values($to, '$user[username] has sent you a message.')") or print(" Could not add to log.");
print "You sent mail to $rec[username].";
}
}
if ($view==delete&&$id) {
$mail = mysql_fetch_array(mysql_query("select * from mail where id=$id"));
if (empty ($mail[id])) {
print "No such mail.";
include("gamefooter.php");
exit;
}
if ($mail[owner] != $user[id]) {
print "That's not your mail.";
include("gamefooter.php");
exit;
}
mysql_query("delete from mail where owner=$user[id] and id=$id");
print"mail deleted";
print"";
}
if ($read) {
$mail = mysql_fetch_array(mysql_query("select * from mail where id=$read"));
if (empty ($mail[id])) {
print "No such mail.";
include("gamefooter.php");
exit;
}
if ($mail[owner] != $user[id]) {
print "That's not your mail.";
include("gamefooter.php");
exit;
}
mysql_query("update mail set unread='T' where id=$mail[id]");
$remail = str_replace("" , "[back]" , $mail[subject]);
$remail = str_replace("" , "[bigsmile]" , $remail);
$remail = str_replace("" , "[cry]" , $remail);
$remail = str_replace("" , "[forward]" , $remail);
$remail = str_replace("" , "[frown]" , $remail);
$remail = str_replace("" , "[frustrated]" , $remail);
$remail = str_replace("" , "[mad]" , $remail);
$remail = str_replace("" , "[pause]" , $remail);
$remail = str_replace("" , "[play]" , $remail);
$remail = str_replace("" , "[smile]" , $remail);
$remail = str_replace("" , "[stop]" , $remail);
$remail = str_replace("" , "[suprised]" , $remail);
$remail = str_replace("" , "[tongue]" , $remail);
$remail = str_replace("" , "[hl]" , $remail);
$remail = str_replace("'","'",$remail);
$remail = str_replace(" " , " " , $remail);
$to=$mail[senderid];
print "$remail: $mail[sender] says: ... \"$mail[body]\".
[Reply] - [Delete] - [Inbox] - [Compose]";
}
?> |