File size: 1.4Kb
<?php
include_once "../config.php";
include_once "../inc/inc.php";
include_once "../inc/func.php";
include_once "../inc/user.php";
if ($kto == 'user') {
$login = htmlspecialchars(stripslashes($login));
$msg = htmlspecialchars(stripslashes($msg));
if (strlen($msg) <= 2) {
header("Location: index.php");
exit;
}
if (strlen($msg) >= 1025) {
header("Location: index.php");
exit;
}
// $msg=smile($msg);
// $login=htmlspecialchars($login);
// $msg=htmlspecialchars($msg);
$vsego = mysql_num_rows(mysql_query("SELECT * FROM " . $pref . "book"));
$zapros2 = 'INSERT INTO ' . $pref . 'book (id_user, data, vrem, dataunix, login, msg, otvet, brow, ip) VALUES (' . (int)$usdata['id'] . ', "' . data() . '", "' . vrem() . '", ' . time() . ', "' . $login . '", "' . $msg . '", " ", "' . brow() . '", "' . ip() . '");';
mysql_query($zapros2);
$query = "SELECT * FROM " . $pref . "book ORDER BY id DESC";
$result = mysql_query($query);
$i = 1;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($i > $maxbook) {
// Удаляем запись по id
$zapros = 'DELETE FROM ' . $pref . 'book WHERE id=\'' . $line['id'] . '\'';
mysql_query($zaoros);
}
$i++;
}
header("Location: index.php");
} else {
header("Location: index.php");
}
?>