Не могу понят почему то выдает всегда вы невыбрали покемона! что делать воть код:
professor.php
Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Профессор Выбор покемона</title>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table>
<form action="/game.php?the=nps_1" method="POST">
<tr>
<td>
<input type="radio" name="poke" value="1" checked><b>#001 Bulbasaur</b><br>
<input type="radio" name="poke" value="4"><b>#004 Charmander</b><br>
<input type="radio" name="poke" value="7"><b>#007 Squirtle</b><br>
<input type="radio" name="poke" value="152"><b>#152 Chikorita</b><br>
<input type="radio" name="poke" value="155"><b>#155 Cyndaquil</b><br>
<input type="radio" name="poke" value="158"><b>#158 Totodile</b><br>
<input type="radio" name="poke" value="252"><b>#252 Treecko</b><br>
<input type="radio" name="poke" value="255"><b>#255 Torchic</b><br>
<input type="radio" name="poke" value="258"><b>#258 Mudkip</b><br>
<input type="radio" name="poke" value="387"><b>#387 Turtwig</b><br>
<input type="radio" name="poke" value="390"><b>#390 Chimchar</b><br>
<input type="radio" name="poke" value="393"><b>#393 Piplup</b><br>
</td>
</tr>
<tr>
<td><input type="submit" value="Выбрать" name="submit" ></td>
</tr>
<br>
</form>
</table>
</body>
</html>
и
start_professor.php
Code
<?php
if (isset($_POST['poke'])){
$pokes = $_POST['poke'];
if ($pokes=='1'){$pokes2 = '1';} else if ($pokes=='4'){$pokes2 = '4';} elseif ($pokes=='7'){$pokes2 = '7';} elseif ($pokes=='152'){$pokes2 = '152';} else if ($pokes=='155'){$pokes2 = '155';} else if ($pokes=='158'){$pokes2 = '158';} else if ($pokes=='252'){$pokes2 = '252';} else if ($pokes=='255'){$pokes2 = '255';} else if ($pokes=='258'){$pokes2 = '258';} else if ($pokes=='387'){$pokes2 = '387';} else if ($pokes=='390'){$pokes2 = '390';} else if ($pokes=='393'){$pokes2 = '393';}
$base_pokes = $pokes2;
$lvl = "6";
$ev = "0";
$gender_pok = ''.mt_rand(1,2);
$zapros_k_db = first('SELECT * FROM bd_pokes WHERE id=%d LIMIT 1',$base_pokes);
$hp = ((($pok['hp']*2)+($ev/4)+100)*($lvl/100))+10;
$atk = (((($pok['atk']*2)+($ev/4))*($lvl/100))+5)*1;
$def = (((($pok['def']*2)+($ev/4))*($lvl/100))+5)*1;
$satk = (((($pok['satk']*2)+($ev/4))*($lvl/100))+5)*1;
$sdef = (((($pok['sdef']*2)+($ev/4))*($lvl/100))+5)*1;
$speed = (((($pok['speed']*2)+($ev/4))*($lvl/100))+5)*1;
$atk_zapr = first('SELECT *, CEIL(RAND()*atac_id) as chance FROM pokemon_bd_atc WHERE poke_base_id=%d AND atc_lvl < 4 ORDER BY chance DESC',$pok['id']);
$pro1 = first('SELECT * FROM players WHERE id=%d ',$_SESSION['id']);
if(empty($_POST['poke'])) {
echo'<center>Вы невыбрали покемона!<br><a href="/game.php?the=world">Уйти</a></center>';
}
elseif($pro1['pokemons_count'] == 0)
{
$user = $_SESSION['ID'];
$user_login = $_SESSION['username'];
$pokes = $_POST['poke'];
// защита от тегов
$pokes = $pokes;
$pokes = trim($pokes);
$pokes = stripslashes($pokes);
$pokes = htmlspecialchars($pokes);
insert('users_pokemons',array(
'base_id'=>$pok['id'],
'name'=>$pok['title'],
'username'=>$user_login,
'lvl'=>$lvl,
'lvl_max'=>100,
'gender'=>$gender_pok,
'lefthover_hp'=>$hp,
'max_hp'=>$hp,
'atk_'=>$atk,
'def_'=>$def,
'satk_'=>$satk,
'sdef_'=>$sdef,
'speed_'=>$speed,
'start_new'=>1,
'ev'=>0,
'started'=>1,
'activeted'=>1,
'razvedenie'=>1,
'atakc_1'=>33,
));
insert('users_items',array('items_id'=>1, 'username'=>$user_login, 'counts'=>1000));
insert('users_items',array('items_id'=>2, 'username'=>$user_login, 'counts'=>10));
update('users',array('soboi'=>1, 'count_poke'=>1),'id='.(int)$_SESSION['id']);
echo'Вы успешно получили своего первого покемона<br><a href="/game.php?the=world">Уйти</a>';
} else (
echo'Вы уже выбирали покемона!<br><a href="/game.php?the=world">Уйти</a>';
)
}
?>
и
game.php
Code
<?php
include ('путь к папке подключения секрет');
switch ( $_GET['the'] ) {
case ('world'):
include ('inc/world.php');
break;
case ('my_pokes'):
include ('inc/pokemons.php');
break;
case ('nps_n'):
include ('inc/professor.php');
break;
case ('nps_1'):
include ('inc/start_professor.php');
break;
case ('map=1'):
include ('inc/locations/loc=1.php');
break;
case ('map=2'):
include ('inc/locations/loc=1.php');
break;
case ('map=3'):
include ('inc/locations/loc=1.php');
break;
case ('map=4'):
include ('inc/locations/loc=1.php');
break;
case ('map=1'):
include ('inc/locations/loc=1.php');
break;
}
?>
Добавлено (26.06.2012, 13:19)
---------------------------------------------
Все разобрался