[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
} elseif (isnum($_GET['msg_send'])) {
require_once INCLUDES."flood_include.php";
if (!flood_control("message_datestamp", DB_MESSAGES, "message_from='".$userdata['user_id']."'"
) {
$result = dbquery(
"SELECT u.user_id, u.user_name, u.user_email, u.user_level, mo.pm_email_notify, s.pm_inbox, COUNT(message_id) as message_count
FROM ".DB_USERS." u
LEFT JOIN ".DB_MESSAGES_OPTIONS." mo USING(user_id)
LEFT JOIN ".DB_MESSAGES_OPTIONS." s ON s.user_id='0'
LEFT JOIN ".DB_MESSAGES." ON message_to=u.user_id AND message_folder='0'
WHERE u.user_id='".$_GET['msg_send']."' GROUP BY u.user_id"
);
if (dbrows($result)) {
$data = dbarray($result);
if ($data['user_id'] != $userdata['user_id']) {
if ($data['user_id'] == 1 || $data['user_level'] > 101 || $data['pm_inbox'] == "0" || ($data['message_count'] + 1) <= $data['pm_inbox']) {
$result = dbquery("INSERT INTO ".DB_MESSAGES." (message_to, message_from, message_subject, message_message, message_smileys, message_read, message_datestamp, message_folder) VALUES('".$data['user_id']."','".$userdata['user_id']."','".$subject."','".$message."','".$smileys."','0','".time()."','0'
"
;
// BEGIN ARROWCHAT NOTIFICATION
$sql = "INSERT INTO arrowchat_notifications (to_id, author_id, author_name, type, alert_time, misc1, misc2, misc3)
VALUES ('".$data['user_id']."', '".$userdata['user_id']."', '".$userdata['user_name']."', '1', '".time()."', '".$data['message_id']."', '', ''
";
mysql_query($sql);
// END
$send_email = isset($data['pm_email_notify']) ? $data['pm_email_notify'] : $msg_settings['pm_email_notify'];
if ($send_email == "1"
{
$message_content = str_replace("[SUBJECT]", $subject, $locale['626']);
$message_content = str_replace("[USER]", $userdata['user_name'], $message_content);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['625'], $data['user_name'].$message_content);
}
} else {
$error = "2";
}
}
} else {
redirect(FUSION_SELF."?folder=inbox&error=noresult"
;
}
} else {
redirect(FUSION_SELF."?folder=inbox&error=flood"
;
}
}[/syntaxhighlighter]
Hey guys I'm trying to get the "message_id" but no luck I try everything the rest works fine I just need the message_id so when you send a msg to a user he will be notify and a small popup like facebook
the upper code is from /messages.php