-
Notifications
You must be signed in to change notification settings - Fork 0
/
processlogin.php
77 lines (43 loc) · 1.18 KB
/
processlogin.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start();
//error_reporting(E_ALL);
//ini_set('display_errors', '1');
require 'functions.php';
$id = $_POST['id'];
$password = $_POST['pass'];
$userq = processLogin($id, $password);
$error = 0;
$user = null;
if(getConfigVar('use_ldap')){
if(mysql_num_rows($userq) == 0){
$error = RES_ERROR_LOGIN_USER_PASS;
}else{
$user = mysql_fetch_assoc($userq);
}
}else{
if(mysql_num_rows($userq) == 0){
$error = RES_ERROR_LOGIN_NO_USER;
}else{
$user = mysql_fetch_assoc($userq);
if($user['password'] != encrypt($password)){
$error = RES_ERROR_LOGIN_USER_PASS;
}
}
}
$page = "";
if($error > 0){
sleep(1);
$page = "Location: ".getConfigVar("location")."index.php?pageid=login&loginoption=".$error;
}
else{
setSessionVariable('user_level', $user['user_level']);
setSessionVariable('user_id', $user['user_id']);
sleep(1);
$page = "Location: ".getConfigVar("location")."index.php?pageid=home&sesid=".session_id();
}
if(strpos($_POST['redir'], "logout") === false && strpos($_POST['redir'], "login") === false){
header("Location: ".$_POST['redir']);
}else{
header($page);
}
?>