Файл: public_html/journal.php
Строк: 61
<?php
include './system/common.php' ;
include './system/functions.php' ;
include './system/user.php' ;
if (!isset( $user )){
header ('Location: index.php' );exit();
}
$title = 'Журнал Сражений' ;
include './system/h.php' ;
$journal_q = mysql_query
("SELECT * FROM `journal` WHERE `user_id`='" . $user
['id' ]. "' ORDER BY `time` DESC LIMIT " .$page ."," . $set
['str' ]. "" );
$total = mysql_num_rows (mysql_query
("SELECT (id) FROM `journal` WHERE `user_id`='" . $user
['id' ]. "'" ));
if( $total == 0){
echo '<div class="name"><center>Журнал [<a href="journal.php?delete"><font color="red">Очистить</font></a>]</div></center>' ;
echo '<div id="error"><center><font color="red">Журнал пуст:(</center></font></div>' ;
include './system/f.php' ;
exit;
}
if(isset( $_GET ['delete' ])){
$jour_u = mysql_fetch_assoc ( mysql_query
("SELECT (id) FROM `journal` WHERE `user_id`='" . $user
['id' ]. "'" ));
if(! $jour_u ){
header ("Location: journal.php" );
exit;
}
mysql_query ("DELETE FROM `journal` WHERE `user_id`='" .
$user[ 'id' ]. "'" );
mysql_query
("UPDATE `users` SET `journal`=0 WHERE `id`='" . $user
['id' ]. "'" );
header ("Location: journal.php" );
exit;
}
if( $user ['journal' ]> 0){
mysql_query
("UPDATE `users` SET `journal`=0 WHERE `id`='" . $user
['id' ]. "'" );
}
$last_mess = mysql_fetch_assoc ( mysql_query
("SELECT * FROM `journal` WHERE `user_id`='" . $user
['id' ]. "' ORDER BY `time` DESC LIMIT 5" ));
echo '<div class="name"><center>Журнал [<a href="journal.php?delete"><font color="red">Очистить</font></a>]</div></center>' ;
echo '<div class="row"> <b><center><font color="green">Наставник</b> (Последняя весть)</font><br><font color="orange">
'. $last_mess ['text' ]. '
</div></font></center>' ;
while( $row = mysql_fetch_assoc ($journal_q )){
if( $row ['read' ]== 1 ){
echo '<div class="row"><font color="green"><small>(новое)</small></font> [' .clock ($row ['time' ]). '] ' .
$row [ 'text' ]. '<br></div>' ;
mysql_query
("UPDATE `journal` SET `read`=0 WHERE `id`='" .$row
['id' ]. "'" );
}else{
echo '<center><font color="orange"><div class="row">[' .clock ($row ['time' ]). '] ' .$row ['text' ]. '</center><br></font></div>' ;
}
}
if( $total > $set ['str' ])
{
pages( $page , $total , 'journal.php' , $set [ 'str' ]);
}
include './system/f.php' ;
?>