Файл: mylaf.ru/otvet/new.vopros.php
Строк: 59
<?php
include '../sys/inc/start.php';
include '../sys/inc/compress.php';
include '../sys/inc/sess.php';
include '../sys/inc/home.php';
include '../sys/inc/settings.php';
include '../sys/inc/db_connect.php';
include '../sys/inc/ipua.php';
include '../sys/inc/fnc.php';
include '../sys/inc/user.php';
$set['title']="Новый вопрос";
include '../sys/inc/thead.php';
title();
aut();
if (!isset($user)){
echo "<div class='err'>Доступ закрыт</div>";
include '../sys/inc/tfoot.php';
}
if (isset($_POST['ok'])){
$name=my_esc($_POST['name']);
$msg=my_esc($_POST['msg']);
if (strlen2($name)<3)$err[]="Короткий вопрос";
if (strlen2($name)>32)$err[]="Длинный вопрос";
if (strlen2($msg)<5)$err[]="Короткое пояснение";
if (strlen2($msg)>1000)$err[]="Длинное пояснение";
if ($_POST['cat']==0)$err[]="Нет такой категории";
if (!isset($err)){
mysql_query("INSERT INTO `otvet` (`id_cat`, `msg`, `id_user`, `name`, `time`) values('$_POST[cat]', '$msg', '$user[id]', '$name', '$time')");
$id=mysql_insert_id();
header("location:vopros.php?id=$id");
}
}
err();
echo "<form method='post' action='?$passgen'>";
echo "Вопрос:</br><input type='text' name='name' value='' style='width:90%'/><br/>";
echo "Пояснения</br><textarea name='msg'></textarea><br/>";
echo "Категория<br />n<select name="cat" style="width:90%"><br />n";
$q=mysql_query("SELECT * FROM `otvet_cat` ORDER BY `pos` ASC");
if (mysql_num_rows($q)>0){
while ($cat = mysql_fetch_assoc($q)){
echo "<option value='".$cat['id']."'>".htmlspecialchars($cat['name'])."</option>n";
}
}
echo "</select><br />n";
echo "<br/><input type='submit' name='ok' value='Задать вопрос' /><br/>n";
echo "</form>";
include '../sys/inc/tfoot.php';
?>