function route($item = 1) {
$exp = explode("/", $_SERVER['REQUEST_URI']);
return $exp[$item];
}
$query = mysql_query("SELECT * FROM `ts_users`");
while ($row = mysql_fetch_array($query)) {
if (route(1) == 'users' && route(2) == $row['pagename']) {
$user_login = route(2);
$query = mysql_query("SELECT * FROM `ts_users` WHERE `pagename`='$user_login'");
$user_info = mysql_fetch_array($query);
echo 'Логин: '.$user_info['user_login'];
exit();
}else{
if (route(1) == 'users' && route(2) == '') {
exit("Список пользователей");
}
if (route(1) == 'users' && route(2) != $row['pagename']) {
$title = "Страница 404";
include_once(ROOT."/core/templates/404.tpl.php");
exit();
}
}
}
switch (route(1)) {
case 'signup':
$title = "Регистрация";
include_once(ROOT."/core/templates/signup.tpl.php");
break;
default:
// code...
break;
}
if (isset($_POST['start'])) {
$rand = mt_rand(1, 12);
$lucky = mt_rand(1, 100);
$change = 100;
if ($lucky <= $change && $rand == $_POST['participant']) {
echo "Вы выиграли!";
}else{
echo "Вы проиграли!";
}
}
<form class="" action="" method="post">
<p><input type="text" name="participant" placeholder="Число"></p>
<p><input type="submit" name="start" value="start"></p>
</form>