if empty user max user max 10 max user max k_post mysql_result mysql_q

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if(empty($user['max'])) $user['max'] = 10;
$max = $user['max'];
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat` WHERE `room` = '".$id."' "),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
$chats = mysql_query("SELECT * FROM `chat` WHERE `room` = '".$id."' ORDER BY `id` DESC LIMIT $start, $max");
while($c = mysql_fetch_assoc($chats))
{
echo '</div><div class="list1">'.nl2br(smiles($c['msg'])).'</div>';
}
второе
break;
case 'otvet':
$id = abs(intval($_GET['id']));
$chat = mysql_fetch_assoc(mysql_query("SELECT * FROM `chat` WHERE `id` = '".$id."'"));
if(isset($_REQUEST['submit'])) {
$msg = guard($_POST['msg']);
if(mb_strlen($msg) < 3) {
echo '<div class="list1"><center><b>Сообщение содержит меньше 3-х символов..</b></center></div>';
require_once ('system/foot.php');
exit();
}
header('Location: /chat/room'.$chat['room'].'');
}
echo '<div class="list1"><form method="POST" action=""><textarea name="msg"></textarea></div>
<div class="list1"><input type="submit" name="submit" value="Написать"></form></div>';