-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
37 lines (30 loc) · 1.13 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
<?php
if(isset($_POST['Submit']))
{
require_once "conf.php";
require_once "dal/mysql.php";
$db = new mysqlDAL;
if($db->checkUser($_POST['Username'], $_POST['Password']))
{
//This cookie is very insecure! A session DB is needed!
setcookie("Username", $_POST['Username']);
$referrer = $_SERVER['HTTP_REFERER'];
if(!empty($referrer)) header("Location: $referrer");
else header("Location: /");
}
else
{
header("Location: login.php");
}
}
else
{
if($_COOKIE['Username'] == "") {?>
<form action="login.php" method="POST">
<input type="text" name="Username" value="User" style="width: 125px; margin-left: 125px;"/>
<input type="password" name="Password" value="Pass" style="width: 125px;" />
<input type="submit" name="Submit" value="Login" style="width: 95px; color: black; height: 25px; padding-top: 0px; " />
</form>
<?php } else echo "Already logged in";
}
?>