-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
21 lines (21 loc) · 879 Bytes
/
Copy pathauth.php
File metadata and controls
21 lines (21 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
if ( !empty($_POST["log"]) && !empty($_POST["pas"]) )
{
include("db_conf.php");
$link = mysql_connect(db_host, db_user, db_pas) or die('Не удалось соединиться: ' . mysql_error());
mysql_select_db('test') or die('неполучилось открыть бд');
//ищем пользователя с таким именем и паролем
$res = mysql_query('select * from users where login="'.$_POST["log"].'" and pass="'.$_POST['pas'].'"');
if ($arRes = mysql_fetch_row($res))
{
// $arRes[0] - id user
setcookie('hash_auth', '12345'); //устанавливаем куку // сделать рендомным потом
mysql_query('update users set hash="12345" where id="'.$arRes[0].'"');
$msg = "ok";
} else $msg = "err";
mysql_close();
} else {
$msg = "err";
}
if ($msg == 'ok') header('Location: /ssv'); else echo $msg;
?>