- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
/*Проверка авторизации*/
if ($action == 'login') {
if (($entlogin && $entpass) <> '') {
$per = "SELECT * FROM ".$sql_dop."users";
if(!mysql_query($per)) {
$page = 'error';
$id = '2,1,1';
}
$result = mysql_query($per);
$qwe = 0;
while ($row = mysql_fetch_row($result)) {
if ($entlogin == $row[1] && md5($entpass) == $row[2]) {
$qwe = 1;
$date = date("d m Y H:i:s");
$mmsec = microtime(msec);
$kod = md5($date.$row[0].$row[1].$row[2].$mmsec);
$does_into_sessions = "INSERT INTO ".$sql_dop."sessions(user,kod) VALUES ('$row[0]','$kod')";
if(!mysql_query($does_into_sessions)) {
error(3,1,1);
}
setcookie('session_code', $kod);
$ubr = 1;
if ($row[10] == 2) {
$urb = 2;
}
if ($row[10] == 3) {
$urb = 2;
}
setcookie('userbar', $urb);
$session_code = $kod;
$page = '';
}
}
} else {
$page = 'error';
$id = '5,0,0';
}
if ($qwe == 0) {
echo "<strong>Ошибка авторизации...</strong>";
echo "<meta http-equiv='refresh' content='1; url=index.php'>";
exit();
}
}