Размер файла: 1.57Kb
<?php
error_reporting(E_ALL ^ E_NOTICE);
define('DATAHOST', 'localhost');
define('DATAUSER', '1111');
define('DATAPASS', '111');
define('DATABASE', '1111');
define('ROOT', 'http://'.$_SERVER['HTTP_HOST']);
define('prefix', 'sale_');
///////////////////////////////////// ДАЛЬШЕ НЕ ТРОГАТЬ ВОБЩЕ! /////////////////////////////////////
require_once (dirname(__FILE__) . '/function.php');
$db = new MySQL;
$fun = new MyFunctions;
$db->connect(DATAHOST, DATAUSER, DATAPASS, DATABASE);
$zapros = $db->query("select * from `".prefix."settings` where `id`='1'");
if (mysql_num_rows($zapros)) {
$set = $db->assoc($zapros);
} else {
exit('Не установлены настройки скрипта!');
}
if (isset($_COOKIE['login']) && isset($_COOKIE['pass'])) {
$login = $_COOKIE['login'];
$_SESSION['login'] = $login;
$pass = $_COOKIE['pass'];
$_SESSION['pass'] = $pass;
}
if (isset($login) && isset($pass)) {
$sql = $db->query("select * from `".prefix."users` where `login`='".$fun->escape($login)."' limit 1");
if (mysql_num_rows($sql)) {
$user = $db->assoc($sql);
if ($pass == $user['pass']) {
$active = true;
} else {
$fun->unsset();
}
} else {
$fun->unsset();
}
}
if (isset($active)) {
if (mysql_num_rows($db->query("select (`id`) from `".prefix."online` where `user`='".$user['login']."' limit 1"))) {
$db->query("update `".prefix."online` set `time`='".time()."' where `user`='".$user['login']."' limit 1");
} else {
$db->query("insert into `".prefix."online` set `time`='".time()."', `user`='".$user['login']."'");
}
}
?>