Datum: {$message->time}
Onderwerp: {$message->subject} |
{$message->message}
|
ENDHTML;
if($message->from != $data->login)
print " from}\">Block | from}&subject=". urlencode("Re: {$message->subject}") ."\">Antwoord | ";
else
print " ";
print "id}\">Delete | \n";
}
}
else if($_GET['p'] == "del") {
if(isset($_GET['id']))
$_POST['id'] = $_GET['id'];
foreach($_POST['id'] as $msgid) {
$dbres = mysql_query("SELECT `outbox`,`inbox`,`from`,`to` FROM `[messages]` WHERE `id`='$msgid' AND (`from`='{$data->login}' OR `to`='{$data->login}')");
if($message = mysql_fetch_object($dbres)) {
if($message->from == $data->login)
mysql_query("UPDATE `[messages]` SET `outbox`=0 WHERE `id`='$msgid'");
else
mysql_query("UPDATE `[messages]` SET `inbox`=0 WHERE `id`='$msgid'");
}
}
print <<Inbox |
- Inbox
- Outbox
- Opgeslagen Berichten
- Blocklist
- Nieuw Bericht
|
Bericht(en) verwijderd |
ENDHTML;
}
else if($_GET['p'] == "block") {
print <<Blocklist |
- Inbox
- Outbox
- Opgeslagen Berichten
- Blocklist
- Nieuw Bericht
|
ENDHTML;
if(isset($_POST['update_list'])) {
$newlist = "";
if(isset($_POST['blocklist'])) {
foreach($_POST['blocklist'] as $blocked) {
if($info = mysql_fetch_object(mysql_query("SELECT `login` FROM `[users]` WHERE `login`='{$blocked}'"))) {
$newlist = preg_replace("/,{$info->login},/i",'',$newlist);
$newlist .= ",{$info->login},";
}
}
}
mysql_query("UPDATE `[users]` SET `blocklist`='$newlist' WHERE `login`='{$data->login}'");
print " De block list is geupdate | ";
$blocklist = $newlist;
}
else {
$dbres = mysql_query("SELECT `blocklist` FROM `[users]` WHERE `login`='{$data->login}'");
$blocklist = mysql_fetch_object($dbres);
$blocklist = $blocklist->blocklist;
}
if(isset($_GET['add'])) {
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='{$_GET['add']}'");
if($sender = mysql_fetch_object($dbres)) {
$blocklist = preg_replace("/,{$sender->login},/i",'',$blocklist);
$blocklist .= ",{$sender->login},";
mysql_query("UPDATE `[users]` SET `blocklist`='$blocklist' WHERE `login`='{$data->login}'");
print " {$sender->login} is geblokt | \n";
}
}
print << | \n";
}
else if($_GET['p'] == "new") {
print <<Nieuw Bericht |
- Inbox
- Outbox
- Opgeslagen Berichten
- Blocklist
- Nieuw Bericht
|
|
|
ENDHTML;
if(isset($_POST['to'],$_POST['message'])) {
if(strtolower($_POST['to']) != strtolower($data->login)) {
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='{$_POST['to']}'");
$info = mysql_fetch_object($dbres);
if($info == false)
print " '{$_POST['to']}' bestaat niet | \n";
else if($info->Mobieltje == -1111111111111111)
print " {$info->login} heeft geen mobiel | \n";
else {
$_POST['subject'] = preg_replace('/','<',$_POST['subject']);
$_POST['message'] = preg_replace('/','<',$_POST['message']);
$dbres = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='{$_POST['to']}'");
if($recp = mysql_fetch_object($dbres)) {
mysql_query("INSERT INTO `[messages]`(`time`,`from`,`to`,`subject`,`message`) values(NOW(),'{$data->login}','{$recp->login}','{$_POST['subject']}','{$_POST['message']}')");
echo "Verzonden | | ";
exit;
}
}
}
else
print " Je kan geen bericht naar jezelf sturen | \n";
}
$_REQUEST['message'] = stripslashes($_REQUEST['message']);
print <<
| |