51 lines
2.1 KiB
PHP
51 lines
2.1 KiB
PHP
<?php
|
|
session_start();
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
date_default_timezone_set('Europe/Moscow');
|
|
//echo '<pre>'.print_r($_SESSION,1).'</pre>';exit();
|
|
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/smarty.php';
|
|
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/_db.php';
|
|
include_once $_SERVER['DOCUMENT_ROOT'].'/config.php';
|
|
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/functions.php';
|
|
|
|
if(isset($_SESSION['user']['id'])){
|
|
$_SESSION['user']['pm_new']=0;
|
|
|
|
$sql = 'SELECT id FROM '.$ST['dbpf'].'_pm WHERE to_user='.$_SESSION['user']['id'].' AND to_status=1 LIMIT 3';
|
|
//$sql = 'SELECT id FROM '.$ST['dbpf'].'_pm WHERE to_user='.$_SESSION['user']['id'].' AND to_status=1 ';
|
|
$rez=$DB->QUR_SEL($sql);if($rez){
|
|
//проверим надо ли обновлять интерфейс, если есть новые сообщения тогда да надо
|
|
$_SESSION['user']['pm_upd']=0; if($_SESSION['user']['pm_new']!=$rez[0]) $_SESSION['user']['pm_upd']=1;
|
|
$_SESSION['user']['pm_new']=$rez[0];
|
|
}else $_SESSION['user']['pm_new']=0;
|
|
|
|
$_SESSION['user']['pm_kol']=0;
|
|
/*
|
|
$sql = 'SELECT id FROM '.$ST['dbpf'].'_pm WHERE to_user='.$_SESSION['user']['id'].' AND to_status!=0';
|
|
$rez=$DB->QUR_SEL($sql);if($rez){ $_SESSION['user']['pm_kol']=$rez[0]; } else $_SESSION['user']['pm_kol']=0;
|
|
*/
|
|
$_SESSION['user']['pm']=array();
|
|
/*
|
|
$sql = 'SELECT * FROM '.$ST['dbpf'].'_pm WHERE to_user='.$_SESSION['user']['id'].' AND to_status!=0 ORDER BY data_c DESC LIMIT 5';
|
|
$rez=$DB->QUR_SEL($sql);
|
|
if($rez){
|
|
$_SESSION['user']['pm']=array();
|
|
foreach($rez as $key => $val)if($key){
|
|
$val['data'] = get_data($val['data_c'],1);
|
|
$val['from'] = get_user($val['from_user']);
|
|
$val['message'] = strip_tags(out_data_fu($val['message']));
|
|
$_SESSION['user']['pm'][]=$val;
|
|
}
|
|
}else $_SESSION['user']['pm']=array();
|
|
*/
|
|
if(isset($_POST['ajax'])&&$_POST['ajax']==1){
|
|
if(isset($_SESSION['user']['pm_upd'])){
|
|
echo $_SESSION['user']['pm_upd'].'|';
|
|
if($_SESSION['user']['pm_upd']!=0){
|
|
$smarty->assign('user',$_SESSION['user']);
|
|
echo $smarty->display('tpl_notification_item.html');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|