View file ajax message alerts vk/ajax/frend.ajax.php

File size: 1.89Kb
<?
if(!(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) die;

include_once '../sys/inc/start.php'; 
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php'; 
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';

?>
<style>
.arr img {
	vertical-align: top;
}
.arr a {
	color:#fff;
}
</style>
<?

if (isset($_SESSION['id_user']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_kont` = '$user[id]' AND `read` = '0' AND `show_vk` = '1'"), 0) > 0)
{
	$q = mysql_query("SELECT * FROM `mail` WHERE `id_kont` = '$user[id]' AND `read` = '0' AND `show_vk` = '1' ORDER BY `time` DESC");
	
	while ($post = mysql_fetch_assoc($q))
	{
		$ank = get_user($post['id_user']);
		
		if (!$ank)$ank['nick'] = 'Пользователь удален';
		elseif ($ank['id'] == 0)$ank['nick'] = 'Система оповещений &trade;';
		
		echo '<div class="arr"  style="background: #4d4d4d; padding: 10px; margin:5px; opacity: 0.9; filter: alpha(Opacity=70);color: #fff; border-radius: 6px; width: 260px;">';
		echo '<b>Новое сообщение</b><br /><table><tr><td style="vertical-align:top; width:50px;">' . status($ank['id']) . '</td> <td style="vertical-align:top; display: block;overflow: hidden; max-height:52px; "><a style="color:#ffffff;" href="/mail.php?id=' . $ank['id'] . '"><b style="color:#8dadef">' . $ank['nick'] . '</b> ' . output_text($post['msg']) . '</a></td></tr></table>';
		echo '</div>';
		
		
	}
	
	// помечаем сообщения как прочитанные
	mysql_query("UPDATE `mail` SET `show_vk` = '0' WHERE `id_kont` = '$user[id]'");
}
exit;
?>