View file football/index.php

File size: 7.57Kb
<?
/**
 * & Author   :: ENK
 * & Contacts :: ICQ 617332
 */

  define('H', $_SERVER['DOCUMENT_ROOT'].'/');
   foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) 
   require H.'sys/inc/'.$inc.'.php'; $num = 1 ;

    $set_game = parse_ini_file(H . 'plugins/games/football/classes/settings.ini');

   if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `_football` WHERE `active` = '1'"),0) == 0)
   {
      mysql_query("INSERT INTO `_football` (`active`, `time`, `rating`, `balls`, `money`) VALUES('1', '".time()."', '" . rand($set_game['rating1'],$set_game['rating2']) . "', '" . rand($set_game['balls1'],$set_game['balls2']) . "', '" . rand($set_game['money1'],$set_game['money2']) . "')");
      header('location: ?');
      exit;
   } else if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `_football_user` WHERE `id_user` = '$user[id]'"),0) == 0)
   {
      mysql_query("INSERT INTO `_football_user`(`id_user`, `date_r`, `sex`) VALUES('$user[id]', '".time()."', '". ($user['pol'] == '0' ? 'female' : 'male') ."')");
      header('location: ?');
      exit;
   }
               

   // class для времени.
   include 'classes/class.game.php';           

  switch (@$_GET['act'])
  {
    default:
                 $set['title'] = 'Чемпионат по футболу';
	               require H . 'sys/inc/thead.php';
	               title().aut().only_reg();

               // Узнаем какой бой активен
               $row_game = mysql_fetch_array(mysql_query("SELECT * FROM `_football` WHERE `active` = '1' LIMIT 1"));
               
               // Вытаскививаем все о юзере в игре.
               $row_user = mysql_fetch_array(mysql_query("SELECT * FROM `_football_user` WHERE `id_user` = '$user[id]' LIMIT 1"));

                // Количество голов у парней
               $row_cnt_udar_male = mysql_result(mysql_query("SELECT COUNT(`udar`) FROM `_football_blow` WHERE `udar` = '1' AND `sex` = 'male' AND `id_football` = '$row_game[sid]'"), 0);

                // Количество голов у девушек
               $row_cnt_udar_female = mysql_result(mysql_query("SELECT COUNT(`udar`) FROM `_football_blow` WHERE `udar` = '1' AND `sex` = 'female' AND `id_football` = '$row_game[sid]'"), 0);

   // Приз за участие.
   include '_inc/my_sql_win.php';
               
   // Делаем удар по воротам.
   include '_inc/my_sql_start.php';


?>
    <link rel="stylesheet" href="game.view.css" type="text/css" />

        <div class='football_header' style='text-align: center;'>
            <img src='_images/futbol.png' alt='*' />
        </div>

        <div class="football_prize" style='display: inline-table;'>
          <img src="_images/5.png" style='float: left;' />
             <img src="_images/m.png" alt='*' /> <b>Какая команда быстрей забьет 20 голлов та и выграла.</b><br />
               <img src="_images/money12.png" alt='*' /> Вознаграждение по окончанию Матча : 

<?
if ($row_game['balls']!=0)echo'<span style="color: blue;">'.$row_game['balls'].' баллов</span> ';
if ($row_game['money']!=0)echo'<span style="color: red;">'.$row_game['money'].' монет</span> ';
if ($row_game['rating']!=0)echo'<span style="color: green;">'.$row_game['rating'].' рейтинга</span>';
?>
        </div>

        <div class='football_panelka' style='text-align: center;'>
Кубков: <b><?= $row_user['life'] ?></b> :: Ударов по воротам: <b><?= $row_user['blows'] ?></b> :: Забито голов: <b><?= $row_user['blows_past'] ?></b>
        </div>
    
   
  <?
   if ($row_cnt_udar_male != 0 || $row_cnt_udar_female != 0)
   {
  ?>
  <table width="100%">
   <tr>
    <td class="football_table" width="50%">
      <? for ($i = 1; $row_cnt_udar_male >= $i; $i++) { ?> <img  src='_images/m.png' alt='*' /> <? } ?>
    </td>
    <td class="football_table" width="50%">
      <? for ($i = 1; $row_cnt_udar_female >= $i; $i++) { ?> <img  src='_images/m.png' alt='*' /> <? } ?>
    </td>
   </tr>
  </table>
  <?
   }
  ?>
  
         <div class="football_logo">
            <img src="_images/multiplayer.jpg" style='margin-top: -1px;' alt="" />
         </div>

  <table class='football_rating' width="100%">
   <tr>
    <td width='50%'>
     <div style='background: #73a8c7; width-max:90%; height: 25px; border-radius: 4px; margin: 3px;'>
     <div style='background: #374079; height: 25px; width: <?= $row_cnt_udar_male*5 ?>%; border-radius: 3px; margin-left: 1px;'></div>
     <span style='position:relative; top: -22px; left: 5%; right: 57%; color: #fff;'><b>М</b></span>
     </div>
    </td>
    
    <td width='50%'>
     <div style='background: #73a8c7; width-max:90%; height: 25px; border-radius: 4px; margin: 3px;'>
     <div style='background: #dc45d3; height: 25px; width: <?= $row_cnt_udar_female*5 ?>%; border-radius: 3px; margin-left: 1px;'></div>
     <span style='position:relative; top: -22px; left: 5%; right: 57%; color: #fff;'><b>Ж</b></span>
     </div>
    </td>
   </tr>
  </table>

     <!--
     <div class='football_rating'>
         <div style='background-color: #de548b; height: 10px; border: 1px solid #c33f74; width: <?= $row_cnt_udar_female*5 ?>%; border-radius: 3px; margin :1px; '></div>
         <div style=' background-color: #3e5bd7; border: 1px solid #253da1; height: 10px; width: <?= $row_cnt_udar_male*5 ?>%; border-radius:3px; margin :1px; '></div>
     </div>
     -->

        <div class='football_game_ats' style='text-align: center;'>
            <a href='?act=chat'>Чат по футболу</a> (<?= mysql_result(mysql_query("SELECT COUNT(id) FROM `_football_chat`"),0) ?>)
        </div>

   <?
       if ($row_user['time_reset'] > $time)
       {
         ?>
          <div class='football_start' style='text-align: center;'>
            <b>Следующий удар через: <?= football::_wtime($row_user['time_reset']-time()) ?></b>
          </div>
         <?
       } else {
         ?>
          <form class='football_start' action="?start" method="post">
            <input class="submit" style="width: 100%;" type="submit" value="Ударить по воротам" />
          </form> 
         <?
       }

   // Вывод чата логов, ударов.
   include '_inc/my_football_chat.php'; 

    ?>
        <div class='football_game_ats'>
            <img src='_images/m.png' alt='*' /> <a href='?act=view'>Просмотреть все матчи</a>
        </div>

        <div class='football_game_ats'>
            <img src='_images/top.png' alt='*' /> <a href='?act=top'>Топ играков</a>
        </div>
    <?

   if (user_access('adm_mysql'))
   {
    ?>
       <div class='football_game_ats'>
         <img src='_images/admin.png' alt='*' /> <a href='?act=admin'>Админка</a>
       </div>
    <?
   }

    break;


    case 'view':
         include '_inc/football_view.php';
    break;

    case 'football':
         include '_inc/football_browsing.php';
    break;

    case 'top':
         include '_inc/my_football_top.php';
    break;

    case 'admin':
         include '_inc/my_admin.php';
    break;

    case 'chat':
         include '_inc/my_football_chatiks.php';
    break;

  }

echo "<div class='foot'><a href='/plugins/games'>";
echo "&laquo;  Онлайн Игры";
echo "</a></div>";
  include_once H.'sys/inc/tfoot.php';