Jump to content
MakeWebGames

Updated Mailbox


Richard

Recommended Posts

  • Replies 124
  • Created
  • Last Reply

Top Posters In This Topic

Re: Updated Mailbox [v1]

Fatal error: Call to a member function query() on a non-object in /home/******/public_html/mailbox.php on line 69

$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 10",$c);

while($r=$db->fetch_row($q))

 

;)

Link to comment
Share on other sites

Re: Updated Mailbox [v1]

<?php

include "globals.php";

if($ir['mailban'])

{

die("<center><font color=red><font size='4' face='Arial, Helvetica, sans-serif'>Error</font>

You have been mail banned for {$ir['mailban']} days.

 

Reason: {$ir['mb_reason']}</font>");

}

$_GET['ID'] = abs((int) $_GET['ID']);

print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Mail Box</font><hr width=90%><table width=90% border=0><tr>

<td width=20% align=center>> Compose</td>

<td width=20% align=center>> Outbox</td>

<td width=20% align=center>> Save</td>

<td width=20% align=center>> Delete All</td>

<td width=20% align=center>> Inbox</td>

</tr></table><hr width=90%>";

switch($_GET['action'])

{

case 'inbox':

mail_inbox();

break;

case 'outbox':

mail_outbox();

break;

case 'compose':

mail_compose();

break;

case 'delete':

mail_delete();

break;

case 'send':

mail_send();

break;

case 'delall':

mail_delall();

break;

case 'delall2':

mail_delall2();

break;

case 'archive':

mail_archive();

break;

case 'read':

mail_view();

break;

case 'mailhome':

mail_home();

break;

default:

mail_home();

break;

}

function mail_home()

{

global $ir,$c,$userid,$h;

print "Below are the Last 10 Messages Sent to You<hr width=90%>

<table width=90% cellpadding=3 class=maintable><tr bgcolor=AAAAAA><th width=30%>From</th><th width=40%>Subject</th><th width=15%>Status</th><th width=15%>Manage</th></tr>";

$q=mysql_query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 10",$c);

while($r=mysql_fetch_array($q))

{

$sent=date('F j, Y, g:i:s a',$r['mail_time']);

print "<tr><td>";

if($r['userid'])

{

print "{$r['username']} [{$r['userid']}]";

}

else

{

print "SYSTEM";

}

$fm=urlencode($r['mail_subject']);

if($r['mail_read'] == 0)

{

$status="<font color=red>Unread</font>";

}

else

{

$status="<font color=green>Read</font>";

}

print "</td>\n<td>Subject: {$r['mail_subject']}

Sent at: $sent</td><td><center> $status</td><td><center>[Delete] [Read]</td></tr>";

}

}

function mail_view()

{

global $ir,$c,$userid,$h;

print "

<table width=90% cellpadding=3 class=maintable>";

$id= abs((int) $_GET['ID']);

$q=mysql_query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_id=$id LIMIT 1");

while($r=mysql_fetch_array($q))

{

$sent=date('F j, Y, g:i:s a',$r['mail_time']);

print "<tr><td bgcolor=#AAAAAA>";

if($r['userid'])

{

print "Mail From: {$r['username']} [{$r['userid']}]";

}

else

{

print "SYSTEM";

}

$fm=urlencode($r['mail_text']);

print "<th bgcolor=#AAAAAA width=75%>Subject: {$r['mail_subject']}</th></tr><tr><td>Sent at: $sent

Reply

Delete

Report</td><td>{$r['mail_text']}</td></tr></table>

<form action='mailbox.php?action=send' method='post'>

<table width=90% cellpadding=3 class='maintable'><th colspan=2 bgcolor=#AAAAAA>Reply To This Message</th> <tr>

<td>User's ID:</td> <td><input type='text' name='userid' value='{$r['userid']}' size='5' maxlength='10' /> <font size=1.9>(E.g. 123456)</font></td></tr><tr>

<td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value=' ' /> <font size=1.9>(E.g. Hello there)</font></td></tr><tr>

<td>Message:</td>

<td><textarea rows='10' cols='75%' name='message'></textarea></td></tr><tr> <td colspan=2><center><input type='submit' value='Send' /></td></tr></form>";

}

mysql_query("UPDATE mail SET mail_read=1 WHERE mail_id=$id",$c);

}

function mail_outbox()

{

global $ir,$c,$userid,$h;

print "Below are the Last 10 Messages You have Sent<hr width=90%>

<table width=90% cellpadding=3 class=maintable><tr bgcolor=AAAAAA><th width=35%>From</th><th width=50%>Subject</th><th width=15%>Manage</th></tr>";

$q=mysql_query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_to=u.userid WHERE m.mail_from=$userid ORDER BY mail_time DESC LIMIT 10",$c);

while($r=mysql_fetch_array($q))

{

$sent=date('F j, Y, g:i:s a',$r['mail_time']);

print "<tr><td>";

if($r['userid'])

{

print "{$r['username']} [{$r['userid']}]";

}

else

{

print "SYSTEM";

}

$fm=urlencode($r['mail_subject']);

if($r['mail_read'] == 0)

{

$status="<font color=red>Unread</font>";

}

else

{

$status="<font color=green>Read</font>";

}

print "</td>\n<td>Subject: {$r['mail_subject']}

Sent at: $sent</td><td><center>[Read]</td></tr>";

}

}

function mail_compose()

{

global $ir,$c,$userid,$h;

print "<form action='mailbox.php?action=send' method='post'>

<table width=90% cellpadding=3 class='maintable'> <tr><td colspan=3 bgcolor=#AAAAAA> Send a Message</td></tr><tr>

<td>User's ID:</td> <td><input type='text' name='userid' value='' size='5' maxlength='10' /> <font size=1.9>(E.g. 123456)</font></td></tr><tr>

<td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value=' ' /> <font size=1.9>(E.g. Hello there)</font></td></tr><tr>

<td>Message:</td>

<td><textarea rows='10' cols='75%' name='message'></textarea></td></tr><tr> <td colspan=2><center><input type='submit' value='Send' /></td></tr></table></form><hr width=90%>> Back to Messages<hr width=90%>";

if($_GET['ID'])

{

print "

<table width=90% cellpadding=3 class='maintable'><tr><td colspan=2 bgcolor=#AAAAAA>Your last 5 mails to/from this person:</td></tr>";

$q=mysql_query("SELECT m.*,u1.username as sender from mail m left join users u1 on m.mail_from=u1.userid WHERE (m.mail_from=$userid AND m.mail_to={$_GET['ID']}) OR (m.mail_to=$userid AND m.mail_from={$_GET['ID']}) ORDER BY m.mail_time DESC LIMIT 5",$c);

while($r=mysql_fetch_array($q))

{

$sent=date('F j, Y, g:i:s a',$r['mail_time']);

print "<tr><td bgcolor=#AAAAAA>$sent</td> <td bgcolor=#AAAAAA>{$r['sender']} wrote: {$r['mail_text']}</td></tr>";

}

print "</table>";

}

}

function mail_send()

{

global $ir,$c,$userid,$h;

$subj=str_replace(array("\n"),array("

"),strip_tags($_POST['subject']));

$msg=str_replace(array("\n"),array("

"),strip_tags($_POST['message']));

$codes = array(

':]',

':D',

':oo:',

'O.o',

':/',

':angry:',

':?:',

':lol:',

':-:',

':O',

':(',

'O.O',

':roll:',

':zzz:',

':)',

':P',

':S',

':nut:',

';)',

':heart:',

'XD',

);

$images = array(

'happy.gif',

'biggrin.gif',

'cool.gif',

'blink.gif',

'dry.gif',

'angry.gif',

'huh.gif',

'laugh.gif',

'mellow.gif',

'ohmy.gif',

'sad.gif',

'ph34r.gif',

'rolleyes.gif',

'sleep.gif',

'smile.gif',

'tongue.gif',

'unsure.gif',

'wacko.gif',

'wink.gif',

'wub.gif',

'XD.gif',

);

$newmsg = str_replace($codes, $images, $msg);

$to= (int) $_POST['userid'];

mysql_query("INSERT INTO mail VALUES ('',0,$userid,$to,unix_timestamp(),'$subj','$newmsg')",$c) or die(mysql_error());

print "Your Message has been Sent.

> Back";

}

function mail_delete()

{

global $ir,$c,$userid,$h;

mysql_query("DELETE FROM mail WHERE mail_id={$_GET['ID']} AND mail_to=$userid",$c);

print "Message deleted.

> Back";

}

function mail_delall()

{

global $ir,$c,$userid,$h;

print "This will delete all the messages in your inbox.

There is NO undo, so be sure.

> Yes, delete all messages

> No, go back";

}

function mail_delall2()

{

global $ir,$c,$userid,$h;

mysql_query("DELETE FROM mail WHERE mail_to=$userid",$c);

print "All ".mysql_affected_rows($c)." mails in your inbox were deleted.

> Back";

}

function mail_archive()

{

global $ir,$c,$userid,$h;

print "This tool will download an archive of all your messages.

> Download Inbox

> Download Outbox";

}

$h->endpage();

?>

 

 

This is the right one for V2 the other one had an Error on it so i fixed it :D :D

Link to comment
Share on other sites

Re: Updated Mailbox [v1]

 

Great mod and I'm using that. Your game looks very similar to Torn City, even the energy bars and icons at the top. :mrgreen:

 

Well Richard's codes are great and his game looks great anyway.

c0der aka JJ

Link to comment
Share on other sites

Re: Updated Mailbox [v1]

how come the smilies don't show up when trying to compose a msg i have made the folder named smilies and uploaded smilies and changed the names to what was on the mod and still nothing showed up i really like this mod but i need my smilies lol someone help

 

 

ps. Richard great mod upgrade :-) :mrgreen:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...