View file wu-engine/wu-actions/load_notif.php

File size: 951B
<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('wu-error'); }
require('../wu-functions/wu_functions.php');

function st($pr) {
switch ($pr) {
case 0: return 'icon-warning text-danger'; break;
case 1: return 'icon-checkmark3 text-success'; break;
case 2: return 'icon-info text-info'; break;
case 3: return 'icon-plus text-success'; break;
default: return 'icon-info text-success';
}
}
$ntf = mysqli_query($connect_db, "SELECT id,msg,st,dt FROM ".DB_PREFIX."_notif WHERE usr='$u_id' ORDER BY id DESC LIMIT 50");
$ntfh = mysqli_num_rows($ntf);
if ($ntfh > 0) {
while ($row = mysqli_fetch_assoc($ntf)) {
echo '<li><i class="'.st($row['st']).'"></i><div>'.$row['msg'].'<span>'.wudate($row['dt']).'</span></div></li>';
}
} else { echo '<li><center>Уведомлений нет</center></li>'; }
mysqli_query($connect_db, "UPDATE ".DB_PREFIX."_notif SET new = '0' WHERE usr='$u_id' AND new = '1'");
?>