Файл: gatekeeper.php
Строк: 25
<?php
require ('lib/core.php');
require ('theme/header.php');
require ('lib/zag.php');
/** скидка с понедельника по четверг с 20:00-00:00**/
$day = date('N');
$time = date('H:i:s');
if(empty($_POST['ot'])){
echo "<form action='/gatekeeper' method='post'>
Откуда?<br>
<select name='ot'>";
$q = mysql_query("SELECT * FROM `l2_city`");
While($w=mysql_fetch_assoc($q)){
echo "<option value='$w[id]'>$w[name]</option>";
}
echo "</select><br>
<select name='to'>";
$q = mysql_query("SELECT * FROM `l2_city`");
While($w=mysql_fetch_assoc($q)){
echo "<option value='$w[id]'>$w[name]</option>";
}
echo "</select><br>
Цена:<br>
<input type='text' name='price'><br>
<input type='submit' value='Создать'></form>";
}else{
$disprice = $_POST['price']/2;
mysql_query("INSERT INTO `l2_gatekeeper` SET `ot`='$_POST[ot]',`to`='$_POST[to]',`type`='city',`price`='$_POST[price]',`disprice`='$disprice'");
header('Location: /gatekeeper');
exit;
}
switch($sd){
default:
$q = mysql_query("SELECT * FROM `l2_gatekeeper` WHERE `ot`='$user[city]' and `type`='city'");
While($w = mysql_fetch_assoc($q)){
$c = mysql_fetch_assoc(mysql_query("SELECT * FROM `l2_city` WHERE `id`='$w[to]'"));
echo "$c[name] ";
if(($day=='1' or $day=='2' or $day=='3' or $day=='4') and ($time>='20:00:00' and $time<='00:00:00')){
echo "(".cena($w['disprice'])." <img src='/pic/adens.png'>)";
}else{
echo "(".cena($w['price'])." <img src='/pic/adens.png' width='16'>)";
}
echo "<br>";
}
break;
}
require ('lib/down.php');
require ('theme/foot.php');
?>