Файл: book/reit.php
Строк: 16
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut) {
$count = $db -> dbcount('COUNT(`id`)','books',"`id` = '".$id."'");
if ($count > 0) {
$te = $db -> query("SELECT * FROM `reit` WHERE `where`='book' and `komy` = '".$id."' and `kto` = '".$ya['id']."' LIMIT 1");
if ($te -> num_rows > 0) {
$db -> query("DELETE FROM `reit` WHERE `komy` = '".$id."' and `where` = 'book' and `kto` = '".$ya['id']."' LIMIT 1");
header('location: book'.$id.'');
}else{
$db -> multi_query("INSERT INTO `reit` SET `where`='book', `kto` = '".$ya['id']."', `komy` = '".$id."',`rei` = '1',`text` = '".$text."',`time` = '".time()."'");
header('location: book'.$id.'');
}
} else header('location: ./');
} else header('location: /aut.php');
?>