-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
68 lines (65 loc) · 2.78 KB
/
login.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
<?php
$log = '';
if (isset($_POST['submit'])) {
require_once 'db.inc.php';
$user = $_POST['user'];
$passwd = $_POST['passwd'];
if (($passwd == '') || ($user == '')) {
$log = "enterdata";
} else if (($passwd != '') && ($user != '')) {
$query = "select * from users where user_id='$user'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 1) {
$row = mysql_fetch_assoc($result);
// session_start();
// $_SESSION['user'] = $user;
// $_SESSION['Last_Activity'] = time();
// $_SESSION['role'] = $row['role'];
// header('Location: home.php');
//
$ldapconn = ldap_connect("adobenet.global.adobe.com") or die("Could not connect to LDAP server.");
if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, 'adobenet\\' . $user, $passwd);
if ($ldapbind) {
$logkey = rand(100000000, 999999999);
$query = "UPDATE users SET logkey = '$logkey' WHERE user_id = '$user'";
mysql_query($query) or die(mysql_error());
session_start();
$_SESSION['user'] = $user;
$_SESSION['Last_Activity'] = time();
$_SESSION['role'] = $row['role'];
header('Location: home.php');
} else {
$log = "fail";
}
}
}
}
}
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Tracker Login Form</title>
<link rel="stylesheet" href="css/style.css">
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<form action="login.php" class="login" method="post">
<h1>Tracker</h1>
<?php if (strpos(strtolower($_SERVER["QUERY_STRING"]), 'loginagain') !== FALSE) { ?>
Session Expired... Login Again
<?php } ?>
<input type="text" name="user" class="login-input" placeholder="User Name" autofocus>
<input type="password" name="passwd" class="login-input" placeholder="Password">
<input type="submit" name="submit" value="Login" class="login-submit">
<!--<p class="login-help"><a href="index.html">Forgot password?</a></p>-->
<?php if ($log == "enterdata") { ?>
<div align="center" style="width:100%; color:#FF0000; font-weight:bold; "> Enter Credentials</div>
<?php } else if ($log == "fail") { ?>
<div align="center" style="width:100%; color:#FF0000; font-weight:bold; ">Enter Valid Credentials</div>
<?php } ?>
</form>
</body>
</html>