View file birthdays.php

File size: 1.93Kb
<?php
include 'sys/db.php';
include 'sys/conf.php';
include 'sys/start.php';
include 'sys/functions.php';
$config_title_name = "Именинники";

include 'style/head.php';
if(isset($user['login'])){
$date_d = date("j");
$date_m = date("m");
$date_y = date("Y");
$date_happy = "$date_d.$date_m.$date_y";
echo "<div class=title>\n";
echo "Именинники на <b>$date_happy</b></div>\n\n\n";

function pgs($start, $total, $page, $onpage){
if ($start != 0) echo '<a href="'.$page.'?start='.($start - $onpage).'">Назад</a> ';
else echo 'Назад';
echo ' | ';
if ($total > $start + $onpage)
echo ' <a href="'.$page.'?start='.($start + $onpage).'">Далее</a>';
else echo 'Далее';}
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `time` = '$timeo' ORDER BY `time`"),0);
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
if($start > $total) $start = 0;
if ($total < $start + 10) $end = $total;
else $end = $start + 10;
$birth = mysql_query("SELECT * FROM `users` WHERE `ank_d_r` = '$date_d' AND `ank_m_r` = '$date_m' ORDER BY `login` DESC LIMIT $start, 10");
if(mysql_num_rows($birth) != 0){
while($ank_happy = mysql_fetch_array($birth)){
$n++;
$years = $date_y - $ank_happy[ank_g_r];
echo "\n\n<div class=content>\n";
if ($ank_happy['gender']==1)echo "<img src='img/man.gif' alt=''> ";
elseif ($ank_happy['gender']==2)echo "<img src='img/woman.gif' alt=''> ";
echo "<a href='anketa.php?id=".$ank_happy['id']."'>".$ank_happy['login']."</a> $years ";
echo case_happy($years, array('год', 'года', 'лет'));
echo"\n</div>\n\n";}
}else{ echo "<div class=content>\n<br><img src='img/lock.gif' alt=''> Сегодня нет именинников :(<br><br>\n</div>\n\n";}
echo "<div class=stat>\n";
pgs($start, $total, 'birthdays.php', 10);
echo "\n</div>\n";
echo "\n<div class=stat><a href='index.php'>Прихожая</a></div>\n\n";
}else{ header ("Location: index.php"); exit;}
include 'style/foot.php';
?>