File size: 3.86Kb
<?
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';
$set['title']='Праздники';
include_once '../sys/inc/thead.php';
title();
aut();
?>
<style>
.vpravo{float:right;}
</style>
<?
function month($month){
if ($month == 1) echo "Январь";
if ($month == 2) echo "Февраль";
if ($month == 3) echo "Март";
if ($month == 4) echo "Апрель";
if ($month == 5) echo "Май";
if ($month == 6) echo "Июнь";
if ($month == 7) echo "Июль";
if ($month == 8) echo "Август";
if ($month == 9) echo "Сентябрь";
if ($month == 10) echo "Октябрь";
if ($month == 11) echo "Ноябрь";
if ($month == 12) echo "Декабрь";
}
function month_skl($month){
if ($month == 1) echo "янв";
if ($month == 2) echo "фев";
if ($month == 3) echo "мар";
if ($month == 4) echo "апр";
if ($month == 5) echo "май";
if ($month == 6) echo "июн";
if ($month == 7) echo "июл";
if ($month == 8) echo "авг";
if ($month == 9) echo "сен";
if ($month == 10) echo "окт";
if ($month == 11) echo "ноя";
if ($month == 12) echo "дек";
}
function kol_vo($month){
return mysql_result(mysql_query("SELECT COUNT(month) FROM `holiday` WHERE `month` = '$month'"),0);
}
if (isset($_GET['id'])) {
$id = intval($_GET['id']); }
else { $id = $user['id']; }
$us=mysql_fetch_assoc(mysql_query("SELECT id, nick FROM `user` WHERE `id` = '".$id."' LIMIT 1"));
if(empty($us)) header("Location: index.php".SID);
echo '<div class="main_menu">';
if($id == $user['id']) {
echo 'Мои праздники</b>';
} else {
echo 'Праздники: <b> '.$us['nick'].' </b>';
}
echo '</div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `holiday_us` WHERE `id_user` = '".$id."' "), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)
{
echo '<div class="err">Нет праздников!</div>';
}
$q=mysql_query("SELECT * FROM `holiday_us` WHERE `id_user` = '".$id."' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
while ($res = mysql_fetch_assoc($q)) {
$my=mysql_fetch_assoc(mysql_query("SELECT * FROM `holiday` WHERE `id` = '".$res['id_hld']."' LIMIT 1"));
echo '<div class="mess">';
echo '<div class="vpravo"><small><span class="title"><i>'.$my['day'].'</i><i> ';
echo month_skl($my['month']);
echo '</i></span></small></div>';
$d = date("d");
$m = date("m");
if($my['day'] == $d and $my['month'] == $m)
{
$today = '<font color="red"> Сегодня </font>';
if($id != $user['id']) {
$gift = '<br /><small><a href = "/user/gift/categories.php?id='.$res['id_user'].'"> Сделать подарок</a> </small>';
}
else
{
$gift = NULL;
}
}
else
{
$today = NULL;
$gift = NULL;
}
echo $today.'<img src="img/hld.png"> '.output_text($my['name']).' '.$gift;
if ($res['id_user'] == $user['id']) {
$hash = md5($my['day']);
echo '<a href="us.php?hld_id='.$res['id'].'&hash='.$hash.'"> <img src="img/delete.png"></a>';
if (isset($_GET['hld_id']) and $_GET['hash'] == md5($my['day'])) {
mysql_query("DELETE FROM `holiday_us` WHERE `id` = '".intval($_GET['hld_id'])."' and `id_user` = '".$user['id']."'");
header("Location: us.php".SID);
$_SESSION['message']='Праздник успешно удален!';
}
}
echo '</div>';
}
if ($k_page>1)str("?id=$id&",$k_page,$page); // Вывод страниц
echo '<div class="foot"><img src="/style/icons/str2.gif"> <a href="index.php">Все праздники</a></div>';
err();
include_once '../sys/inc/tfoot.php';
?>