PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
cbrian
Forum Commoner
Posts: 97 Joined: Sun Feb 27, 2005 12:29 pm
Post
by cbrian » Sun Mar 20, 2005 7:58 pm
I'm writing a mail service for my game, and I'm having trouble figuring out how not to show the mails sent by someone on the users blocked list. Here's what I have so far to show the mails:
Code: Select all
$i = 0;
print("<td>");
$q = mysql_query("SELECT * FROM `blocked` WHERE `by`='$userid' AND `who`='{$mail['from']}'");
while(($mail=mysql_fetch_assoc($query)) && ($i <= 30) && (mysql_num_rows($q) == "0")) {
if($mail['read'] == "0") {
$b = 'style=\"font-weight:bold\"';
}
$from = mysql_query("SELECT username FROM users WHERE userid='{$mail['from']}'");
$from = mysql_fetch_array($from);
$from = $from[0];
$datetime = explode(' ', $mail['datetime']);
$date = $datetime[0];
$time = $datetime[1];
$date = explode("-", $date);
$month = $date[1];
$day = $date[2];
$date = $month . '/' . $day;
$date = $date . ' ' . $time;
if($mail['read'] == "0") {
print("<tr><td class=\"bold\" colspan=1><b>{$date}</b></td>
<td class=\"bold\" colspan=1><b><a style=\"color:black\" href=\"game.php?where=messenger&stamp=$timestamp&do=read&read={$mail['id']}\" title=\"{$mail['message']}\">{$mail['subject']}</a></b></td>
<td class=\"bold\" colspan=1><b><a style=\"color:black\" href=\"game.php?where=profile&stamp=$timestamp&who={$mail['from']}\">{$from}</a></b></td></tr>");
} else {
print("<tr><td colspan=1>{$date}</td>
<td colspan=1><a style=\"color:black\" href=\"game.php?where=messenger&stamp=$timestamp&do=read&read={$mail['id']}\" title=\"{$mail['message']}\">{$mail['subject']}</a></td>
<td colspan=1><a style=\"color:black\" href=\"game.php?where=profile&stamp=$timestamp&who={$mail['from']}\">{$from}</a></td>
<td colspan=1><a style=\"color:black\" href=\"game.php?where=messenger&stamp=$timestamp&do=inbox&delete=yes&id={$mail['id']}\">DEL</a></td></tr>");
}
$i++;
}
cbrian
Forum Commoner
Posts: 97 Joined: Sun Feb 27, 2005 12:29 pm
Post
by cbrian » Sun Mar 20, 2005 8:21 pm
I'm writing a mail service for my game, and I'm having trouble figuring out how not to show the mails sent by someone on the users blocked list.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Mar 20, 2005 8:25 pm
Phenom wrote: and specifically the problem is?
What is being returned? Have you tried inserting debugging outputs?
Are you outputting your variables so they are as expected?
cbrian
Forum Commoner
Posts: 97 Joined: Sun Feb 27, 2005 12:29 pm
Post
by cbrian » Sun Mar 20, 2005 8:36 pm
Sorry, what I'm trying to say is that I am just not sure how to put it through something to make sure the mail is not from someone who's blocked.
hongco
Forum Contributor
Posts: 186 Joined: Sun Feb 20, 2005 2:49 pm
Post
by hongco » Sun Mar 20, 2005 9:14 pm
i am a bit confused...anyway, is it right that your script will let users to send emails, and you don't want to show the emails belong to blocked users? If so, my suggestion is that if any users who are on the blocked list, he/she will not be given permission to send email.
the below query will yield info of those who are Not on the blocked list. I am not sure if this is waht you are trying to do?
Code: Select all
$query = "SELECT * FROM users u, blocked b where u.user_id != b.user_id";