/
login.php
87 lines (83 loc) · 1.9 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
ini_set("display_errors", 1);
require_once("classes/db_connection.php");
require_once("classes/user.php");
if (isset($_POST["txtUserName"]))
{
$user_name = trim($_POST["txtUserName"]);
$password = $_POST["txtPassword"];
$user = null;
try
{
DBConnection::Connect();
$user = User::Load($user_name, $password);
DBConnection::Close();
}
catch (Exception $ex)
{
}
if ($user != null)
{
$user->SetCookie();
//header("Location: /huji/");
?>
<script type="text/javascript">
window.parent.location.href = window.parent.location.href;
</script>
<?php
exit();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/login.css?v=0.0.1" />
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<?php
if (isset($_POST["txtUserName"]))
{
?>
<div class="error">
לא נמצא משתמש לפי הפרטים שהוזנו.
</div>
<?php
}
?>
<form name="frmLogin" method="post" onsubmit="return (checkForm());">
<?php
// TODO: Make sucide because of using tables to orgenize the page, instead of divs and css
?>
<table>
<tr>
<td>
שם משתמש:
</td>
<td>
<input type="text" name="txtUserName" id="txtUserName" />
</td>
</tr>
<tr>
<td>
סיסמה:
</td>
<td>
<input type="password" name="txtPassword" id="txtPassword" />
</td>
</tr>
<tr>
<td>
<input type="button" value="ביטול" onclick="window.parent.closeMiniPage();" />
</td>
<td>
<input type="submit" value="התחבר" />
</td>
</tr>
</table>
</form>
</body>
</html>