Jump to content
MakeWebGames

Magictallguy

Administrators
  • Posts

    2,146
  • Joined

  • Last visited

  • Days Won

    150

Everything posted by Magictallguy

  1. My custom ROM built based on CyanogenMod - I was, and am still happy with my phone (even though I hate phones and, therefore, barely ever use it!)
  2. Wow, that is old work there! Here's the re-recode for v1 (directly based on OP) NOTE! This code has only been tested for parse errors <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- mailbox.php -- --------------------- -- Re-recoded by Magictallguy -----------------------------------------------------*/ function file_check($file) { if(!file_exists(__DIR__ . '/' . $file.'.php')) exit('You\'re missing a major file!'); require(__DIR__ . '/' . $file.'.php'); } function s($num) { return $num == 1 ? '' : 's'; } function format($str, $dec = 0) { return is_numeric($str) ? number_format($str, $dec) : stripslashes(htmlentities($str, ENT_COMPAT, 'UTF-8')); } function kill($msg) { global $h; echo "<font size='4' face='Arial, Helvetica, sans-serif'>Error</font><br /><br />",$msg; $h->endpage(); exit; } if(!isset($_SESSION)) session_start(); file_check('global_func'); if(!isset($_SESSION['loggedin']) || empty($_SESSION['loggedin']) || !isset($_SESSION['userid']) || empty($_SESSION['userid']) || !is_int($_SESSION['userid'])) { header('Location: login.php'); exit; } $userid = $_SESSION['userid']; file_check('header'); $h = new headers; $h->startheaders(); file_check('mysql'); global $c; if(!is_resource($c)) exit('You\'re not connected to the database'); $is = mysql_query('SELECT `u`.*, `us`.* ' . 'FROM `users` AS `u` ' . 'LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) ' . 'WHERE `u`.`userid` = '.$userid, $c) or kill(mysql_error()); if(!mysql_num_rows($is)) { session_unset(); session_destroy(); exit('There appears to be an issue with your account'); } $ir = mysql_fetch_assoc($is); $current_row = 0; check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'],''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); if($ir['mailban']) kill("<center><font color=red>You have been mail banned for ".format($ir['mailban'])." day".s($ir['mailban']).".<br /> <strong>Reason: ".format($ir['mb_reason'])."</font></strong>"); $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs(@intval($_GET['ID'])) : null; ?><center><font size='4' face='Arial, Helvetica, sans-serif'>Mail Box</font><hr width='90%'><table width='90%' border=0><tr> <td width='20%' class='center'>> <a href='mailbox.php?action=compose'> Compose</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=outbox'> Outbox</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=archive'> Save</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=delall'> Delete All</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=mailhome'> Inbox</a></td> </tr></table><hr width='90%'><?php $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch($_GET['action']) { case 'inbox': mail_inbox(); break; case 'outbox': mail_outbox(); break; case 'compose': mail_compose(); break; case 'delete': mail_delete(); break; case 'delall': mail_delall(); break; case 'archive': mail_archive(); break; case 'read': mail_view(); break; case 'readmail': mail_view_outbox(); break; default: mail_home(); break; } function mail_home() { global $ir, $c, $userid, $h, $current_row; ?>Below are the Last 10 Messages Sent to You<hr width='90%'> <table width='90%' cellpadding='2'> <tr bgcolor='AAAAAA'> <th width='30%'>From</th> <th width='40%'>Subject</th> <th width='15%'>Status</th> <th width='15%'>Manage</th> </tr><?php $q = mysql_query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) ' . 'WHERE `m`.`mail_to` = '.$userid.' ORDER BY `mail_time` DESC LIMIT 10', $c); if(!mysql_num_rows($q)) echo '<tr><td colspan="4" class="center">You have no messages</td></tr>'; else while($r = mysql_fetch_assoc($q)) { echo '<tr class="row',$current_row,'"> <td>',($r['userid'] ? '<a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'),'</td> <td><strong>Subject:</strong> <a href="mailbox.php?action=read&ID=',$r['mail_id'],'">',format($r['mail_subject']),'</a> <em>Sent at: ',date('F j, Y, g:i:s a', $r['mail_time']),'</em></td> <td class="center">',(!$r['mail_read'] ? '<span style="color:red;">Unread</span>' : '<span style="color:green;">Read</span>'),'</td> <td class="center">[<a href="mailbox.php?action=delete&ID=',$r['mail_id'],'">Delete</a>] [<a href="mailbox.php?action=read&ID=',$r['mail_id'],'">Read</a>]</td> </tr>'; --$current_row; } ?></table><?php } function mail_view() { global $ir, $c, $userid, $h; $q = mysql_query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) ' . 'WHERE `m`.`mail_id` = '.$_GET['ID'].' AND `m`.`mail_to` = '.$userid); if(!mysql_num_rows($q)) kill('Either that message doesn\'t exist, or it\'s not yours to read!'); mysql_query('UPDATE `mail` SET `mail_read` = 1 WHERE `mail_id` = '.$_GET['ID'], $c) or kill(mysql_error()); $r = mysql_fetch_assoc($q); $from = ($r['userid']) ? '<strong>Mail From:</strong> <a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'; ?><table width='90%' cellpadding='2'> <tr class='row1'> <th bgcolor='#AAAAAA' width='75%'><strong>Subject:</strong> <?php echo format($r['mail_subject']);?></th> </tr> <tr> <td>Sent at: <?php echo date('F j, Y, g:i:s a', $r['mail_time']);?> <a href='mailbox.php?action=compose&ID=<?php echo $r['mail_from'];?>'>Reply</a> <a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id'];?>'>Delete</a> <a href='preport.php?ID=<?php echo $r['mail_from'];?>'>Report</a></td> <td><?php echo format($r['mail_text']);?></td> </tr> </table> <form action='mailbox.php?action=send' method='post'> <table width='90%' cellpadding='2'> <tr> <th colspan='2' bgcolor='#AAAAAA'><strong>Reply To This Message</strong></th> </tr> <tr class='row1'> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo isset($r['userid']) ? $r['userid'] : '';?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Send' /></td> </tr> </table> </form><?php } function mail_view_outbox() { global $ir, $c, $userid, $h; $q = mysql_query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_to` = `u`.`userid`) ' . 'WHERE `m`.`mail_id` = '.$_GET['ID'].' AND `m`.`mail_from` = '.$userid); if(!mysql_num_rows($q)) kill('Either that message doesn\'t exist, or it\'s not yours to read!'); $r = mysql_fetch_assoc($q); $from = ($r['userid']) ? '<strong>Mail To:</strong> <a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'; ?><table width='90%' cellpadding='2'> <tr class='row1'> <th bgcolor='#AAAAAA' width='75%'><strong>Subject:</strong> <?php echo format($r['mail_subject']);?></th> </tr> <tr> <td>Sent at: <?php echo date('F j, Y, g:i:s a', $r['mail_time']);?> <a href='mailbox.php?action=compose&ID=<?php echo $r['mail_to'];?>'>Compose</a> <a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id'];?>'>Delete</a></td> <td><?php echo format($r['mail_text']);?></td> </tr> </table> <form action='mailbox.php?action=send' method='post'> <table width='90%' cellpadding='2'> <tr> <th colspan='2' bgcolor='#AAAAAA'><strong>Compose Another Message</strong></th> </tr> <tr class='row1'> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo isset($r['userid']) ? $r['userid'] : '';?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Send' /></td> </tr> </table> </form><?php } function mail_outbox() { global $ir, $c, $userid, $h, $current_row; ?>Below are the Last 10 Messages You've Sent<hr width='90%'> <table width='90%' cellpadding='2'> <tr bgcolor='AAAAAA'> <th width='30%'>To</th> <th width='40%'>Subject</th> <th width='15%'>Status</th> <th width='15%'>Manage</th> </tr><?php $q = mysql_query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_to` = `u`.`userid`) ' . 'WHERE `m`.`mail_from` = '.$userid.' ORDER BY `mail_time` DESC LIMIT 10', $c); if(!mysql_num_rows($q)) echo '<tr><td colspan="4" class="center">You have no messages</td></tr>'; else while($r = mysql_fetch_assoc($q)) { echo '<tr class="row',$current_row,'"> <td>',($r['userid'] ? '<a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'),'</td> <td><strong>Subject:</strong> <a href="mailbox.php?action=read&ID=',$r['mail_id'],'">',format($r['mail_subject']),'</a> <em>Sent at: ',date('F j, Y, g:i:s a', $r['mail_time']),'</em></td> <td class="center">',(!$r['mail_read'] ? '<span style="color:red;">Unread</span>' : '<span style="color:green;">Read</span>'),'</td> <td class="center">[<a href="mailbox.php?action=delete&ID=',$r['mail_id'],'">Delete</a>] [<a href="mailbox.php?action=read&ID=',$r['mail_id'],'">Read</a>]</td> </tr>'; --$current_row; } ?></table><?php } function mail_compose() { global $ir, $c, $userid, $h, $current_row; if(!array_key_exists('submit', $_POST)) { ?><form action='mailbox.php?action=compose' method='post'> <table width='90%' cellpadding='2'> <tr> <td colspan='3' bgcolor='#AAAAAA'><strong>Send a Message</strong></td> </tr> <tr> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo $_GET['ID'];?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Send' /></td> </tr> </table> </form> <hr width='90%'>> <a href='mailbox.php'>Back to Messages</a><hr width='90%'><?php if(!empty($_GET['ID'])) { ?><table width='90%' cellpadding='2'> <tr> <td colspan='2' bgcolor='#AAAAAA'><strong>Your last 5 mails to/from this person:</strong></td> </tr><?php $q = mysql_query('SELECT `m`.*, `u1`.`username` AS `sender` ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `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) or kill(mysql_error()); if(!mysql_num_rows($q)) echo "<tr><td colspan='2' class='center'>None found</td></tr>"; else while($r = mysql_fetch_assoc($q)) { ?><tr class='row<?php echo $current_row;?>'> <td><?php echo date('F j, Y, g:i:s a', $r['mail_time']);?></td> <td><strong><?php echo format($r['sender']);?> wrote:</strong> <?php echo format($r['mail_text']);?></td> </tr><?php --$current_row; } ?></table><?php } } else { $_POST['userid'] = isset($_POST['userid']) && ctype_digit($_POST['userid']) ? abs(@intval($_POST['userid'])) : null; if(empty($_POST['userid'])) kill("You didn't enter a valid player's ID"); $selectUser = mysql_query("SELECT `userid` FROM `users` WHERE `userid` = ".$_POST['userid'], $c) or kill(mysql_error()); if(!mysql_num_rows($selectUser)) kill("That player doesn't exist!"); $subj = str_replace("\n", '', strip_tags(mysql_real_escape_string($_POST['subject'], $c))); $msg = str_replace("\n", '', strip_tags(mysql_real_escape_string($_POST['message'], $c))); $codes = array( ':]', '<img src="images/smilies/biggrin.png" border="0" alt="" title="Big Grin" class="inlineimg" />', '<img src="images/smilies/redface.png" border="0" alt="" title="Embarrassment" class="inlineimg" />o:', 'O.o', ':/', ':angry:', ':?:', ':lol:', ':-:', ':O', '<img src="images/smilies/frown.png" border="0" alt="" title="Frown" class="inlineimg" />', 'O.O', ':roll:', ':zzz:', '<img src="images/smilies/smile.png" border="0" alt="" title="Smile" class="inlineimg" />', ':P', ':S', ':nut:', '<img src="images/smilies/wink.png" border="0" alt="" title="Wink" class="inlineimg" />', ':heart:', 'XD', ); $images = array( '[img=smilies/happy.gif]', '[img=smilies/biggrin.gif]', '[img=smilies/cool.gif]', '[img=smilies/blink.gif]', '[img=smilies/dry.gif]', '[img=smilies/angry.gif]', '[img=smilies/huh.gif]', '[img=smilies/laugh.gif]', '[img=smilies/mellow.gif]', '[img=smilies/ohmy.gif]', '[img=smilies/sad.gif]', '[img=smilies/ph34r.gif]', '[img=smilies/rolleyes.gif]', '[img=smilies/sleep.gif]', '[img=smilies/smile.gif]', '[img=smilies/tongue.gif]', '[img=smilies/unsure.gif]', '[img=smilies/wacko.gif]', '[img=smilies/wink.gif]', '[img=smilies/wub.gif]', '[img=smilies/XD.gif]', ); $newmsg = str_replace($codes, $images, $msg); mysql_query("INSERT INTO `mail` VALUES ('', 0, ".$userid.", ".$to.", ".time().", '".$subj."', '".$newmsg."')", $c) or kill(mysql_error()); echo "Your Message has been sent.<gbr /><a href='mailbox.php'>> Back</a>"; } } function mail_delete() { global $ir, $c, $userid, $h; if(empty($_GET['ID'])) kill("You didn't select a valid message"); $select = mysql_query("SELECT `mail_id` FROM `mail` WHERE `mail_id` = ".$_GET['ID']." AND `mail_to` = ".$userid, $c) or kill(mysql_error()); if(!mysql_num_rows($select)) kill("Either that message doesn't exist, or it's not yours to delete"); mysql_query("DELETE FROM `mail` WHERE `mail_id` = ".$_GET['ID'], $c) or kill(mysql_error()); echo "Message deleted.<br /><a href='mailbox.php'>> Back</a>"; } function mail_delall() { global $ir, $c, $userid, $h; if(!array_key_exists('answer', $_GET)) { ?>This will delete all the messages in your inbox.<br /> There is <strong>NO</strong> undo, so be sure.<br /> <a href='mailbox.php?action=delall&answer=yes'>> Yes, delete all messages</a> ยท <a href='mailbox.php'>> No, go back</a><?php } else { mysql_query("DELETE FROM `mail` WHERE `mail_to` = ".$userid, $c) or kill(mysql_error()); echo format(mysql_affected_rows())." message".s(mysql_affected_rows())." ".(mysql_affected_rows() == 1 ? 'has' : 'have')." been deleted.<br /> <a href='mailbox.php'>> Back</a>"; } } function mail_archive() { ?>This tool will download an archive of all your messages.<br /> <a href='dlarchive.php?a=inbox'>> Download Inbox</a><br /> <a href='dlarchive.php?a=outbox'>> Download Outbox</a><?php } $h->endpage();   And here's the re-recode for v2 NOTE! This code has only been tested for parse errors <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- mailbox.php -- --------------------- -- Re-recoded and converted to v2 by Magictallguy -----------------------------------------------------*/ function s($num) { return $num == 1 ? '' : 's'; } function format($str, $dec = 0) { return is_numeric($str) ? number_format($str, $dec) : stripslashes(htmlentities($str, ENT_COMPAT, 'UTF-8')); } function kill($msg) { global $h; echo "<font size='4' face='Arial, Helvetica, sans-serif'>Error</font><br /><br />",$msg; $h->endpage(); exit; } include(__DIR__ . '/globals.php'); if($ir['mailban']) kill("<center><font color=red>You have been mail banned for ".format($ir['mailban'])." day".s($ir['mailban']).".<br /> <strong>Reason: ".format($ir['mb_reason'])."</font></strong>"); $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs(@intval($_GET['ID'])) : null; ?><center><font size='4' face='Arial, Helvetica, sans-serif'>Mail Box</font><hr width='90%'><table width='90%' border=0><tr> <td width='20%' class='center'>> <a href='mailbox.php?action=compose'> Compose</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=outbox'> Outbox</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=archive'> Save</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=delall'> Delete All</a></td> <td width='20%' class='center'>> <a href='mailbox.php?action=mailhome'> Inbox</a></td> </tr></table><hr width='90%'><?php $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch($_GET['action']) { case 'inbox': mail_inbox(); break; case 'outbox': mail_outbox(); break; case 'compose': mail_compose(); break; case 'delete': mail_delete(); break; case 'delall': mail_delall(); break; case 'archive': mail_archive(); break; case 'read': mail_view(); break; case 'readmail': mail_view_outbox(); break; default: mail_home(); break; } function mail_home() { global $db, $ir, $userid, $hurrent_row; ?>Below are the Last 10 Messages Sent to You<hr width='90%'> <table width='90%' cellpadding='2'> <tr bgcolor='AAAAAA'> <th width='30%'>From</th> <th width='40%'>Subject</th> <th width='15%'>Status</th> <th width='15%'>Manage</th> </tr><?php $q = $db->query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) ' . 'WHERE `m`.`mail_to` = '.$userid.' ORDER BY `mail_time` DESC LIMIT 10'); if(!$db->num_rows($q)) echo '<tr><td colspan="4" class="center">You have no messages</td></tr>'; else while($r = $db->fetch_row($q)) { echo '<tr class="row',$current_row,'"> <td>',($r['userid'] ? '<a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'),'</td> <td><strong>Subject:</strong> <a href="mailbox.php?action=read&ID=',$r['mail_id'],'">',format($r['mail_subject']),'</a> <em>Sent at: ',date('F j, Y, g:i:s a', $r['mail_time']),'</em></td> <td class="center">',(!$r['mail_read'] ? '<span style="color:red;">Unread</span>' : '<span style="color:green;">Read</span>'),'</td> <td class="center">[<a href="mailbox.php?action=delete&ID=',$r['mail_id'],'">Delete</a>] [<a href="mailbox.php?action=read&ID=',$r['mail_id'],'">Read</a>]</td> </tr>'; --$current_row; } ?></table><?php } function mail_view() { global $db, $ir, $userid, $h; $q = $db->query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) ' . 'WHERE `m`.`mail_id` = '.$_GET['ID'].' AND `m`.`mail_to` = '.$userid); if(!$db->num_rows($q)) kill('Either that message doesn\'t exist, or it\'s not yours to read!'); $db->query('UPDATE `mail` SET `mail_read` = 1 WHERE `mail_id` = '.$_GET['ID']); $r = $db->fetch_row($q); $from = ($r['userid']) ? '<strong>Mail From:</strong> <a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'; ?><table width='90%' cellpadding='2'> <tr class='row1'> <th bgcolor='#AAAAAA' width='75%'><strong>Subject:</strong> <?php echo format($r['mail_subject']);?></th> </tr> <tr> <td>Sent at: <?php echo date('F j, Y, g:i:s a', $r['mail_time']);?> <a href='mailbox.php?action=compose&ID=<?php echo $r['mail_from'];?>'>Reply</a> <a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id'];?>'>Delete</a> <a href='preport.php?ID=<?php echo $r['mail_from'];?>'>Report</a></td> <td><?php echo format($r['mail_text']);?></td> </tr> </table> <form action='mailbox.php?action=send' method='post'> <table width='90%' cellpadding='2'> <tr> <th colspan='2' bgcolor='#AAAAAA'><strong>Reply To This Message</strong></th> </tr> <tr class='row1'> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo isset($r['userid']) ? $r['userid'] : '';?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Send' /></td> </tr> </table> </form><?php } function mail_view_outbox() { global $db, $ir, $userid, $h; $q = $db->query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_to` = `u`.`userid`) ' . 'WHERE `m`.`mail_id` = '.$_GET['ID'].' AND `m`.`mail_from` = '.$userid); if(!$db->num_rows($q)) kill('Either that message doesn\'t exist, or it\'s not yours to read!'); $r = $db->fetch_row($q); $from = ($r['userid']) ? '<strong>Mail To:</strong> <a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'; ?><table width='90%' cellpadding='2'> <tr class='row1'> <th bgcolor='#AAAAAA' width='75%'><strong>Subject:</strong> <?php echo format($r['mail_subject']);?></th> </tr> <tr> <td>Sent at: <?php echo date('F j, Y, g:i:s a', $r['mail_time']);?> <a href='mailbox.php?action=compose&ID=<?php echo $r['mail_to'];?>'>Compose</a> <a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id'];?>'>Delete</a></td> <td><?php echo format($r['mail_text']);?></td> </tr> </table> <form action='mailbox.php?action=send' method='post'> <table width='90%' cellpadding='2'> <tr> <th colspan='2' bgcolor='#AAAAAA'><strong>Compose Another Message</strong></th> </tr> <tr class='row1'> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo isset($r['userid']) ? $r['userid'] : '';?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Send' /></td> </tr> </table> </form><?php } function mail_outbox() { global $db, $ir, $userid, $hurrent_row; ?>Below are the Last 10 Messages You've Sent<hr width='90%'> <table width='90%' cellpadding='2'> <tr bgcolor='AAAAAA'> <th width='30%'>To</th> <th width='40%'>Subject</th> <th width='15%'>Status</th> <th width='15%'>Manage</th> </tr><?php $q = $db->query('SELECT `m`.*, `u`.* ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `u` ON (`m`.`mail_to` = `u`.`userid`) ' . 'WHERE `m`.`mail_from` = '.$userid.' ORDER BY `mail_time` DESC LIMIT 10'); if(!$db->num_rows($q)) echo '<tr><td colspan="4" class="center">You have no messages</td></tr>'; else while($r = $db->fetch_row($q)) { echo '<tr class="row',$current_row,'"> <td>',($r['userid'] ? '<a href="viewuser.php?u='.$r['userid'].'">'.format($r['username']).'</a> ['.format($r['userid']).']' : 'SYSTEM'),'</td> <td><strong>Subject:</strong> <a href="mailbox.php?action=read&ID=',$r['mail_id'],'">',format($r['mail_subject']),'</a> <em>Sent at: ',date('F j, Y, g:i:s a', $r['mail_time']),'</em></td> <td class="center">',(!$r['mail_read'] ? '<span style="color:red;">Unread</span>' : '<span style="color:green;">Read</span>'),'</td> <td class="center">[<a href="mailbox.php?action=delete&ID=',$r['mail_id'],'">Delete</a>] [<a href="mailbox.php?action=read&ID=',$r['mail_id'],'">Read</a>]</td> </tr>'; --$current_row; } ?></table><?php } function mail_compose() { global $db, $ir, $userid, $hurrent_row; if(!array_key_exists('submit', $_POST)) { ?><form action='mailbox.php?action=compose' method='post'> <table width='90%' cellpadding='2'> <tr> <td colspan='3' bgcolor='#AAAAAA'><strong>Send a Message</strong></td> </tr> <tr> <td>User's ID:</td> <td><input type='text' name='userid' value='<?php echo $_GET['ID'];?>' size='5' maxlength='10' /> <i><font size='1.9'>(E.g. 123456)</font></i></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' size='50' maxlength='50' value='' /> <i><font size='1.9'>(E.g. Hello there)</font></i></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='75%' name='message'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Send' /></td> </tr> </table> </form> <hr width='90%'>> <a href='mailbox.php'>Back to Messages</a><hr width='90%'><?php if(!empty($_GET['ID'])) { ?><table width='90%' cellpadding='2'> <tr> <td colspan='2' bgcolor='#AAAAAA'><strong>Your last 5 mails to/from this person:</strong></td> </tr><?php $q = $db->query('SELECT `m`.*, `u1`.`username` AS `sender` ' . 'FROM `mail` AS `m` ' . 'LEFT JOIN `users` AS `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'); if(!$db->num_rows($q)) echo "<tr><td colspan='2' class='center'>None found</td></tr>"; else while($r = $db->fetch_row($q)) { ?><tr class='row<?php echo $current_row;?>'> <td><?php echo date('F j, Y, g:i:s a', $r['mail_time']);?></td> <td><strong><?php echo format($r['sender']);?> wrote:</strong> <?php echo format($r['mail_text']);?></td> </tr><?php --$current_row; } ?></table><?php } } else { $_POST['userid'] = isset($_POST['userid']) && ctype_digit($_POST['userid']) ? abs(@intval($_POST['userid'])) : null; if(empty($_POST['userid'])) kill("You didn't enter a valid player's ID"); $selectUser = $db->query("SELECT `userid` FROM `users` WHERE `userid` = ".$_POST['userid']); if(!$db->num_rows($selectUser)) kill("That player doesn't exist!"); $subj = str_replace("\n", '', strip_tags($db->real_escape_string($_POST['subject']))); $msg = str_replace("\n", '', strip_tags($db->real_escape_string($_POST['message']))); $codes = array( ':]', '<img src="images/smilies/biggrin.png" border="0" alt="" title="Big Grin" class="inlineimg" />', '<img src="images/smilies/redface.png" border="0" alt="" title="Embarrassment" class="inlineimg" />o:', 'O.o', ':/', ':angry:', ':?:', ':lol:', ':-:', ':O', '<img src="images/smilies/frown.png" border="0" alt="" title="Frown" class="inlineimg" />', 'O.O', ':roll:', ':zzz:', '<img src="images/smilies/smile.png" border="0" alt="" title="Smile" class="inlineimg" />', ':P', ':S', ':nut:', '<img src="images/smilies/wink.png" border="0" alt="" title="Wink" class="inlineimg" />', ':heart:', 'XD', ); $images = array( '[img=smilies/happy.gif]', '[img=smilies/biggrin.gif]', '[img=smilies/cool.gif]', '[img=smilies/blink.gif]', '[img=smilies/dry.gif]', '[img=smilies/angry.gif]', '[img=smilies/huh.gif]', '[img=smilies/laugh.gif]', '[img=smilies/mellow.gif]', '[img=smilies/ohmy.gif]', '[img=smilies/sad.gif]', '[img=smilies/ph34r.gif]', '[img=smilies/rolleyes.gif]', '[img=smilies/sleep.gif]', '[img=smilies/smile.gif]', '[img=smilies/tongue.gif]', '[img=smilies/unsure.gif]', '[img=smilies/wacko.gif]', '[img=smilies/wink.gif]', '[img=smilies/wub.gif]', '[img=smilies/XD.gif]', ); $newmsg = str_replace($codes, $images, $msg); $db->query("INSERT INTO `mail` VALUES ('', 0, ".$userid.", ".$to.", ".time().", '".$subj."', '".$newmsg."')"); echo "Your Message has been sent.<gbr /><a href='mailbox.php'>> Back</a>"; } } function mail_delete() { global $db, $ir, $userid, $h; if(empty($_GET['ID'])) kill("You didn't select a valid message"); $select = $db->query("SELECT `mail_id` FROM `mail` WHERE `mail_id` = ".$_GET['ID']." AND `mail_to` = ".$userid); if(!$db->num_rows($select)) kill("Either that message doesn't exist, or it's not yours to delete"); $db->query("DELETE FROM `mail` WHERE `mail_id` = ".$_GET['ID']); echo "Message deleted.<br /><a href='mailbox.php'>> Back</a>"; } function mail_delall() { global $db, $ir, $userid, $h; if(!array_key_exists('answer', $_GET)) { ?>This will delete all the messages in your inbox.<br /> There is <strong>NO</strong> undo, so be sure.<br /> <a href='mailbox.php?action=delall&answer=yes'>> Yes, delete all messages</a> ยท <a href='mailbox.php'>> No, go back</a><?php } else { $db->query("DELETE FROM `mail` WHERE `mail_to` = ".$userid); echo format($db->affected_rows())." message".s($db->affected_rows())." ".($db->affected_rows() == 1 ? 'has' : 'have')." been deleted.<br /> <a href='mailbox.php'>> Back</a>"; } } function mail_archive() { ?>This tool will download an archive of all your messages.<br /> <a href='dlarchive.php?a=inbox'>> Download Inbox</a><br /> <a href='dlarchive.php?a=outbox'>> Download Outbox</a><?php } $h->endpage();
  3. Whozits? I got a mention? Yay! Free fame! *spreads fame around like butter* But yeah, I can always re-recode it and post up again if wanted
  4. It wouldn't be anything spectacular. It'd be a MySQLi (or PDO, haven't decided yet (most likely MySQLi, due to being able to work OOTB without having to change every other file)) class designed to handle PHP<->database relations.
  5. Find the first instance of: <?php Add below: if(!isset($_SESSION['playerid']) || empty($_SESSION['playerid']) || !is_int($_SESSION['playerid'])) exit;   Find: $q_ry = "SELECT `e_id` FROM `member_events` WHERE `e_playerid` = '".mysql_real_escape_string($_SESSION['playerid'])."' AND `e_read` = '0'"; Replace with: $q_ry = "SELECT `e_id` FROM `member_events` WHERE `e_read` = 0 AND `e_playerid` = ".$_SESSION['playerid'];   Find and remove: $evs = array();   Find: $evs = mysql_query($q_ry); Replace with: $evs = mysql_query($q_ry) or exit(mysql_error());   Optional edits: Find: if(mysql_num_rows($evs)){echo "$sound"; } Replace with: if(mysql_num_rows($q_ry)) echo $sound;   Find (around line 942): if($_SESSION['attacking']) { header('location:run.php'); } Replace with: if(isset($_SESSION['attacking'])) { header('Location: run.php'); exit; }   Find any instance of: mysql_real_escape_string($_SESSION['playerid']) Replace all with: $_SESSION['playerid']   Also: Test all queries! If it's failing, you want it to fail so you can debug it (and prevent it from failing again)   And, of course, it should go without saying.. Upgrade yourself to MySQLi at the very least!
  6. Grab yourself a copy of v1, I'll write up a class that'd work for (but better than) v2 - and I'll host you
  7. Agreed and seconded!
  8. Teh Fuzzeh Manz! Magictallguy1, feel free :) I've got 91 games, so I can't be arsed to list them all - instead, watch this video haha
  9. Kung Fu is a collection of martial arts styles. (technically speaking, it's a Chinese term referring to any form of study, learning or practise that requires patience, energy and time. (also know as Wushu)) Wing Chun, for example, is a form of Kung Fu. 'tis also one of the most famous styles as Bruce Lee used it. Shaolin being another. Believe me when I say, it's not the same ;)
  10. Ran a test and ... holy ****ake mushrooms! There are so many insecurities in that site, I could have a field day!
  11. I don't.. Kung Fu all the way!
  12. S'all good, happy to help :)
  13. Add $needs = ''; above the foreach() loop
  14. Confirmed. He's one hell of a designer :)
  15. That looks like my chat's code...
  16. The little code snippet you posted showed nothing for sanitation or validation. I was going, purely, from your post. All I did was validate, then sanitize, then validate again - which, yes, it does look like a lot of work, but try and exploit that code ;)
  17. Wish I'd thought of that when I wrote my success/warning/info/error functions haha
  18. False, you can use his method - though I'd recommend a rather large update first. if(!array_key_exists('xferu', $_POST)) { echo 'The form hasn\'t been submitted'; exit($h->endpage()); } $_POST['xferu'] = isset($_POST['xferu']) && ctype_digit($_POST['xferu']) ? $_POST['xferu'] : null; if(empty($_POST['xferu'])) { echo 'You didn\'t enter a valid player ID'; exit($h->endpage()); } $select = $db->query('SELECT `username` FROM `users` WHERE `userid` = '.$_POST['xferu']); if(!$db->num_rows($select)) { echo 'That player doesn\'t exist'; exit($h->endpage()); } // Continue here.. make sure to validate input for amount too!
  19. Question; does this effect already existing posts?
  20. A DMCA for use my mod that I've allowed? Get a grip of yourself, there's plenty of hard feelings Ibraheem..   Yes.   The way I've done it uses its own table with only 1 addition to the (grpg)users table. The reason I've not routed it through an access file is due to a security flaw that would arise by using encrypted URLs - you simply can't beat hard-coded methods when it comes to things like that.
  21. Whereas, I'm quite against it. Studies have shown the drawbacks (no pun intended) in prolonged use. I have previously smoked it, stopped and made a promise to my other half never to touch it again. With that being said, it depends on "which" weed you get your hands on. If you get the stuff that's been sprayed with THC, then it's not weed. If you get the stuff that's been laced with f*ck knows what, then it's not weed. <-- that's the stuff that has been used in the studies. If you get the stuff that has had no extra "modification" done to it, then the choice is yours. Smoke it, or don't. Just let it be known that I'm against it :P
  22. Don't worry about it, I can add you to the queue :)
  23. It is indeed. There's a slight delay, due to all the IRL stuff going on, but you will get what you ask for :)
×
×
  • Create New...