Файл: tech/stata.php
Строк: 119
<?
session_start();
include ('../inc/db.php');
include '../inc/functions.php';
if (isset($_SESSION['user_id']))
{
$query = "SELECT *
FROM `user`
WHERE `id_user`='{$_SESSION['user_id']}'
LIMIT 1";
$sql = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($sql);
// если нету такой записи с пользователем
// ну вдруг удалили его пока он лазил по сайту.. =)
// то надо ему убить ID, установленный в сессии, чтобы он был гостем
if (mysql_num_rows($sql) != 1)
{
$title = "Панель управления";
include '../inc/head.php';
?>
<div class="name">Ошибка:</div>
<div class="err">
У вас нет прав для доступа к этой странице!
</div>
<div class="name">Навигация:</div>
<div class="links"><a href="../index.php">На главную</a></div>
</div>
<?
include ('../inc/foot.php');
exit;
} else {
// показываем защищенные от гостей данные.
$title = "Cтатистика событий";
include '../inc/head.php';
if (empty($_GET)) {
$date = date('d F Y');
$query6 = "SELECT *
FROM `sob` WHERE `date` LIKE '%$date%'";
$sql6 = mysql_query($query6) or die(mysql_error());
$count_1 = mysql_num_rows($sql6);
$day = date('d');
$year = date('F Y');
$vch = $day -1;
$date2 = ''.$vch.' '.$year.'';
$query7 = "SELECT *
FROM `sob` WHERE `date` LIKE '%$date2%'";
$sql7 = mysql_query($query7) or die(mysql_error());
$count_2 = mysql_num_rows($sql7);
$day1 = date('d');
$year1 = date('F Y');
$vch1 = $day1 +1;
$date3 = ''.$vch1.' '.$year1.'';
$query8 = "SELECT *
FROM `sob` WHERE `date` LIKE '%$date3%'";
$sql8 = mysql_query($query8) or die(mysql_error());
$count_3 = mysql_num_rows($sql8);
?>
<div class="name">Статистика событий</div>
<div class="blockout">
<div class="blockin">
<?
if ($count_2 != 0) {
echo '<div class="re"><a href="stata.php?str=vch">За вчера</a> ('.$count_2.')</div>';
} else {
echo '<div class="re">За вчера ставок нет</div>';
}
if ($count_1 != 0) {
echo '<div class="re"><a href="stata.php?str=seg">За сегодня</a> ('.$count_1.')</div>';
} else {
echo '<div class="re">На сегодня ставок нет</div>';
}
if ($count_3 != 0) {
echo '<div class="re"><a href="sta.php?str=zav">На завтра</a> ('.$count_3.')</div>';
} else {
echo '<div class="re">На завтра ставок нет</div>';
}
?>
</div></div>
<div class="name">Навигация:</div>
<div class="links"><a href="../index.php">На главную</a></div>
<?
}
if ($_GET['str']=='seg') {
$date = date('d F Y');
?>
<div class="name"><?echo my_date($date);?></div>
<?
$query1 = "SELECT *
FROM `cat_sob` ORDER BY `name` ASC";
$sql1 = mysql_query($query1) or die(mysql_error());
while ($myrow = mysql_fetch_assoc($sql1)) {
$query2 = "SELECT *
FROM `sob` WHERE `id_sob` = '{$myrow[id]}' AND `date` LIKE '%$date%'";
$sql2 = mysql_query($query2) or die(mysql_error());
if (mysql_num_rows($sql2) != 0)
{
?>
<div class="name"><?echo $myrow['name'];?></div>
<div class="gr">
<?
while ($myrow2 = mysql_fetch_assoc($sql2)) {
$querye = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE id_sob='{$myrow2['id']}'");
$myrowe = mysql_fetch_assoc($querye) ;
$querye1 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k1' AND id_sob='{$myrow2['id']}'");
$myrowe1 = mysql_fetch_assoc($querye1) ;
$query6 = "SELECT *
FROM `stavki` WHERE `k`='k1' AND id_sob='{$myrow2['id']}'";
$sql6 = mysql_query($query6) or die(mysql_error());
$count_k1 = mysql_num_rows($sql6);
$querye2 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k2' AND id_sob='{$myrow2['id']}'");
$myrowe2 = mysql_fetch_assoc($querye2) ;
$query7 = "SELECT * FROM `stavki` WHERE `k`='k2' AND id_sob='{$myrow2['id']}'";
$sql7 = mysql_query($query7) or die(mysql_error());
$count_k2 = mysql_num_rows($sql7);
$querye3 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k3' AND id_sob='{$myrow2['id']}'");
$myrowe3 = mysql_fetch_assoc($querye3) ;
$query8 = "SELECT *
FROM `stavki` WHERE `k`='k3' AND id_sob='{$myrow2['id']}'";
$sql8 = mysql_query($query8) or die(mysql_error());
$count_k3 = mysql_num_rows($sql8);
?>
<div class="link">
<?
echo '<b>'.$myrow2['com1'].' - '.$myrow2['com2'].'</b><br/>';
echo 'П1 - <b>'.$myrow2['k1'].'</b> Х - <b>'.$myrow2['k2'].'</b> П2 - <b>'.$myrow2['k3'].'</b><br/>';
echo 'Начало: '.my_date($myrow2['date']).'<br/>';
?>
</div>
<?
}
?>
</div>
<?
} else {
}
}
?>
<div class="name">Навигация:</div>
<div class="links"><a href="../index.php">На главную</a></div>
<?
}
///вчера
if ($_GET['str']=='vch') {
$day = date('d');
$year = date('F Y');
$vch = $day -1;
$date = ''.$vch.' '.$year.'';
?>
<div class="name"><?echo my_date($date);?></div>
<?
$query1 = "SELECT *
FROM `cat_sob` ORDER BY `name` ASC";
$sql1 = mysql_query($query1) or die(mysql_error());
while ($myrow = mysql_fetch_assoc($sql1)) {
$query2 = "SELECT * FROM `sob` WHERE `id_sob` = '{$myrow[id]}' AND `date` LIKE '%$date%'";
$sql2 = mysql_query($query2) or die(mysql_error());
if (mysql_num_rows($sql2) != 0)
{
?>
<div class="name"><?echo $myrow['name'];?></div>
<div class="blockout">
<div class="blockin">
<?
while ($myrow2 = mysql_fetch_assoc($sql2)) {
$querye = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE id_sob='{$myrow2['id']}'");
$myrowe = mysql_fetch_assoc($querye) ;
$querye1 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k1' AND id_sob='{$myrow2['id']}'");
$myrowe1 = mysql_fetch_assoc($querye1) ;
$query6 = "SELECT *
FROM `stavki` WHERE `k`='k1' AND id_sob='{$myrow2['id']}'";
$sql6 = mysql_query($query6) or die(mysql_error());
$count_k1 = mysql_num_rows($sql6);
$querye2 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k2' AND id_sob='{$myrow2['id']}'");
$myrowe2 = mysql_fetch_assoc($querye2) ;
$query7 = "SELECT * FROM `stavki` WHERE `k`='k2' AND id_sob='{$myrow2['id']}'";
$sql7 = mysql_query($query7) or die(mysql_error());
$count_k2 = mysql_num_rows($sql7);
$querye3 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k3' AND id_sob='{$myrow2['id']}'");
$myrowe3 = mysql_fetch_assoc($querye3) ;
$query8 = "SELECT *
FROM `stavki` WHERE `k`='k3' AND id_sob='{$myrow2['id']}'";
$sql8 = mysql_query($query8) or die(mysql_error());
$count_k3 = mysql_num_rows($sql8);
?>
<div class="link">
<?
echo '<b>'.$myrow2['com1'].' - '.$myrow2['com2'].'</b><br/>';
echo 'П1 - <b>'.$myrow2['k1'].'</b> Х - <b>'.$myrow2['k2'].'</b> П2 - <b>'.$myrow2['k3'].'</b><br/>';
echo 'Начало: '.my_date($myrow2['date']).'<br/>';
?>
</div>
<?
}
?>
</div>
</div>
</div>
<?
} else {
}
}
?>
<div class="name">Навигация:</div>
<div class="links"><a href="../index.php">На главную</a></div>
<?
}
///вчера
if ($_GET['str']=='zav') {
$day = date('d');
$year = date('F Y');
$vch = $day +1;
$date = ''.$vch.' '.$year.'';
?>
<div class="name"><?echo my_date($date);?></div>
<?
$query1 = "SELECT *
FROM `cat_sob` ORDER BY `name` ASC";
$sql1 = mysql_query($query1) or die(mysql_error());
while ($myrow = mysql_fetch_assoc($sql1)) {
$query2 = "SELECT *
FROM `sob` WHERE `id_sob` = '{$myrow[id]}' AND `date` LIKE '%$date%'";
$sql2 = mysql_query($query2) or die(mysql_error());
if (mysql_num_rows($sql2) != 0)
{
?>
<div class="name"><?echo $myrow['name'];?></div>
<div class="gr">
<?
while ($myrow2 = mysql_fetch_assoc($sql2)) {
$querye = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE id_sob='{$myrow2['id']}'");
$myrowe = mysql_fetch_assoc($querye) ;
$querye1 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k1' AND id_sob='{$myrow2['id']}'");
$myrowe1 = mysql_fetch_assoc($querye1) ;
$query6 = "SELECT *
FROM `stavki` WHERE `k`='k1' AND id_sob='{$myrow2['id']}'";
$sql6 = mysql_query($query6) or die(mysql_error());
$count_k1 = mysql_num_rows($sql6);
$querye2 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k2' AND id_sob='{$myrow2['id']}'");
$myrowe2 = mysql_fetch_assoc($querye2) ;
$query7 = "SELECT * FROM `stavki` WHERE `k`='k2' AND id_sob='{$myrow2['id']}'";
$sql7 = mysql_query($query7) or die(mysql_error());
$count_k2 = mysql_num_rows($sql7);
$querye3 = mysql_query("SELECT SUM(money) AS moneytotal FROM stavki WHERE `k`='k3' AND id_sob='{$myrow2['id']}'");
$myrowe3 = mysql_fetch_assoc($querye3) ;
$query8 = "SELECT *
FROM `stavki` WHERE `k`='k3' AND id_sob='{$myrow2['id']}'";
$sql8 = mysql_query($query8) or die(mysql_error());
$count_k3 = mysql_num_rows($sql8);
?>
<div class="link">
<?
echo '<b>'.$myrow2['com1'].' - '.$myrow2['com2'].'</b><br/>';
echo 'Поб.1 - <b>'.$myrow2['k1'].'</b> Ничья Х - <b>'.$myrow2['k2'].'</b> Поб.2 - <b>'.$myrow2['k3'].'</b><br/>';
echo 'Начало: '.my_date($myrow2['date']).'<br/>';
?>
</div>
<?
}
?>
</div>
<?
} else {
}
}
?>
<div class="name">Навигация:</div>
<div class="blockout">
<div class="blockin">
<div class="link"><a href="../index.php">На главную</a></div>
</div></div>
<?
}
include ('../inc/foot.php');
}} else {
$title = "Панель управления";
include '../inc/head.php';
?>
<div class="name">Ошибка:</div>
<div class="blockout">
<div class="blockin">
У вас нет прав для доступа к этой странице!
</div></div>
<div class="name">Навигация:</div>
<div class="blockout">
<div class="blockin">
<div class="link"><a href="../index.php">На главную</a></div>
</div></div>
<?
include ('../inc/foot.php');
exit;
}
?>