lt;?session_start();include('./work.php');header('Content-type:application/xhtml+xml;charset=utf-8');echo $prolog;db_connect();if(!isset($_POST['nick'])&&!isset($_SESSION['nick']))error('<form action="index.php" method="post">Введите ник:<br/><input type="text" name="nick" maxlength="10"/><br/><input type="submit"/></form>');if(!isset($_SESSION['nick'])&&isset($_POST['nick'])){$zanyat=mysql_query("SELECT * FROM `battle` WHERE `starter`='".$_POST['nick']."' OR `enemy`='".$_POST['nick']."'");if(!mysql_rows($zanyat)){$_SESSION['nick']=$_POST['nick'];echo 'Ваш ник: '.$_SESSION['nick'];}else error('Ник пока занят!');}if(isset($_SESSION['id_game'])){echo 'вы уже играете!<br/><a href="fight.php">к бою</a>';exit($final);}$games=mysql_query("SELECT * FROM `battle` WHERE `game`='0'");echo '<br/>'.mysql_rows($games).' игр <br/>';while(mysql_array($games)) {echo '<a href="fight.php?id='.$games['id'].'">'.$games['starter'].'-'.$games['time'].'</a><br/>';}echo '<a href="create.php">создать</a><br/>'.$final;?> |
lt;?$up=array_sum(explode(' ',microtime())); // время$prolog='<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>авторизация</title></head><body><p align="left">';$final='</p><p align="center">-=-=-</p><p align="left"><small>['.slow().']</small></p></body></html>';function slow() {global $up;return round(array_sum(explode(' ',microtime()))-$up,4);}if(!$connect=mysql_connect('localhost','db_helqg',':)'))exit ('База в ауте:-('.$final);mysql_select_db('db_helqg',$connect);function error($mess) {global $final;session_destroy();echo '<strong>'.$mess.'</strong>';exit($final);}?> |
CREATE TABLE `battle` |
( |
`id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT, |
`game` INT UNSIGNED NOT NULL, |
`starter` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, |
`enemy` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, |
`hod` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, |
`time` INT UNSIGNED NOT NULL, |
`a1` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, |
`a2` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a3` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a4` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a5` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a6` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a7` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a8` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`a9` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, |
PRIMARY KEY(`id`) |
) TYPE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; |