Jump to content
MakeWebGames

Mailbox View


Recommended Posts

Based on the previous post (the non-updated one), here:

 

<?php
function mail_inbox() {
global $ir, $c;
?>Only the last 25 messages sent to you are visible.
<hr width='75%' />
<table width="75%" class="table" border="0" cellspacing="1">
	<tr>
		<th width="20%">Sent/From</th>
		<th width="60%">Subject/Message</th>
		<th width="20%">Actions</th>
	</tr><?php
$q = mysql_query("SELECT `m`.*, `u`.`userid`, `u`.`username`, `u`.`donatordays`, `u`.`user_level`, `u`.`mail_signature` " .
					"FROM `mail` AS `m` " .
					"LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) " .
					"WHERE `m`.`mail_to` = ".$ir['userid']." AND `m`.`mail_deleted` = 0 " .
				"ORDER BY `m`.`mail_time` DESC LIMIT 25", $c);
if(!mysql_num_rows($q))
	echo "<tr><td colspan='2' class='center'>You have no messages</td></tr>";
else
	while($r = mysql_fetch_assoc($q)) {
		$d = $r['donatordays'] 
			? "<img src='/images/donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />"
			: '';
		$staff = ($r['user_level'] > 1)
			? "<img src='images/staff.gif 'width='10' height='10' alt='Staff' title='Staff' />"
			: '';
		if($r['userid']) {
			$get = mysql_query("SELECT `imagepath` FROM `user_imageusername` WHERE `userid` = ".$r['userid'], $c);
			if(mysql_num_rows($get))
				$r['username'] = '<img src="images/username/'.$r_image['imagepath'].'" title="'.$r['username'].'" width="110px" height="20px" />';
		}
		if($r['user_level'] == 26)
			$user = "<span style='color:red;'>".$r['username']."</span>";
		else if($r['user_level'] == 2)
			$user = "<span style='color:gold;'>".$r['username']."</span>";
		else if($r['user_level'] == 3)
			$user = "<span style='color:green;'>".$r['username']."</span>";
		else if($r['user_level'] == 4)
			$user = "<span style='color:pink;'>".$r['username']."</span>";
		else if($r['user_level'] == 5)
			$user = "<span style='color:cyan;'>".$r['username']."</span>";
		else if($r['donatordays'])
			$user = "<span style='color:red;'>".$r['username']."</span>";
		else
			$user = $r['username'];
		?><tr>
			<td><strong>From:</strong><br /><?php echo ($r['userid']) ? "<a href='viewuser.php?u=".$r['userid']."'>".$user."</a> ".$d." ".$staff." [".$r['userid']."]" : ''; ?><br />
			<strong>Sent on:</strong> <?php echo date('F j, Y, g:i:s a', $r['mail_time']); ?></td>
			<td><table class='table' width='100%'>
				<tr>
					<td><?php echo stripslashes(htmlspecialchars($r['mail_subject'])); ?></td>
				</tr>
				<tr>
					<td><?php echo nl2br(stripslashes(htmlspecialchars($r['mail_text']))); ?></td>
				</tr>
			</table></td>
			<td><a href='mailbox.php?action=compose&ID=<?php echo $r['userid']; ?>'>Reply</a><br />
				<a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id']; ?>'>Delete</a><br />
				<a href='preport.php?ID=<?php echo $r['userid']; ?>&report=Fradulent mail: <?php echo urlencode($r['mail_text']); ?>'>Report</a><br />
			<a href='mailbox.php?action=addblock&ID=<?php echo $r['userid']; ?>'>Block</a></td>
		</tr><?php
	}
if($ir['new_mail'] > 0) {
	mysql_query("UPDATE `mail` SET `mail_read` = 1 WHERE `mail_to` = ".$ir['userid'], $c);
	mysql_query("UPDATE `users` SET `new_mail` = 0 WHERE `userid` = ".$ir['userid'], $c);
}
?></table>
<hr width='75%' />
<hr width='90%' />
<table width='50%'>
	<tr>
		<td width='50%'><a href='explore.php'>Go Explore</a></td>
		<td width='50%'><a href='index.php'>Go Home</a></td>
	</tr>
</table>
<hr width='90%' /><?php
}
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...