Файл: 3020.ru/file_3020/_system/_function/sql.func.php
Строк: 54
<?
/*
* Отправка сообщений в журнал
*/
function journal($id, $type = 'other', $msg) {
global $sql, $time;
$id = (int) $id;
$ank = $sql -> fetch("SELECT `id` FROM `users` WHERE `id` = '$id' LIMIT 1");
if ($ank['id']) {
$msg = $sql->esc($msg);
$sql -> insert("INSERT INTO `journal` (`id_user`, `time`, `msg`, `type`) VALUES ('" . $id . "', '$time', '$msg', '$type')");
return true;
} else {
return false;
}
}
/*
* Отправка сообщений в админ журнал
*/
function admin_journal($id, $type = 'other', $msg) {
global $sql, $time, $system;
$id = (int) $id;
$ank = $sql -> fetch("SELECT `id` FROM `users` WHERE `id` = '$id' LIMIT 1");
if ($ank['id']) {
$msg = $sql->esc($msg);
$sql -> insert("INSERT INTO `admin_journal` (`id_user`, `time`, `msg`, `type`) VALUES ('" . $id . "', '$time', '$msg', '$type')");
return true;
} else {
return false;
}
}
/**
* Лог действий администрации
*/
function admin_log($id, $name, $msg) {
global $sql, $time;
$id = (int) $id;
$name = explode("|", $name);
if ($sql -> selectCount("SELECT COUNT(*) FROM `admin_log_cat` WHERE `name` = '$name[0]'") == 0) {
$sql -> insert("INSERT INTO `admin_log_cat` (`name`) VALUES ('$name[0]')");
}
$cat = $sql -> fetch("SELECT `id` FROM `admin_log_cat` WHERE `name` = '$name[0]' LIMIT 1");
if ($sql -> selectCount("SELECT COUNT(*) FROM `admin_log_razd` WHERE `name` = '$name[1]' AND `cat` = '$cat[id]'") == 0) {
$sql -> insert("INSERT INTO `admin_log_razd` (`name`, `cat`) VALUES ('$name[1]', '$cat[id]')");
}
$razd = $sql -> fetch("SELECT `id` FROM `admin_log_razd` WHERE `name` = '$name[1]' AND `cat` = '$cat[id]' LIMIT 1");
$msg = $sql->esc($msg);
$sql -> insert("INSERT INTO `admin_log` (`id_user`, `time`, `msg`, `cat`, `razd`) VALUES ('" . $id . "', '$time', '$msg', '$cat[id]', '$razd[id]')");
}
?>