php require_once core system php require_once core head php switch act

 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
<?php
require_once 'core/system.php';
require_once 'core/head.php';
switch($act) {
case 'post':
if(isset($_POST['nick']) && isset($_POST['pass'])) {
$nick = check($_POST['nick']);
$pass = check($_POST['pass']);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `nick` = '".$nick."' && `pass` = '".$pass."'"),0) == false) $err = 'Неверный ник или пароль';
if(!isset($err)) {
setcookie('nick', $nick, time() + 84600 * 15, '/');
setcookie('pass', $pass, time() + 84600 * 15, '/');
header('Location: /');
exit();
} else {
header('Location: /');
$_SESSION['err'] = $err;
exit();
}
} else {
header('Location: /');
$_SESSION['err'] = 'Заполните поля';
exit();
}
}
require_once 'core/foot.php';
?>