bzr branch
http://gegoxaren.bato24.eu/bzr/extremedating/trunk
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
1 |
<?php
|
2 |
include "php/db.php"; |
|
3 |
||
|
26
by Daniel Johansson
Fixed sessions for logins |
4 |
$password = sha1($_POST['password']."salt"); |
5 |
$username = $_POST['username']; |
|
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
6 |
|
|
26
by Daniel Johansson
Fixed sessions for logins |
7 |
if(isset($_SESSION ['userName'])) { |
|
15
by Daniel Johansson
Fixed stuffz |
8 |
echo "You can not login whilest you are logedin..."; |
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
9 |
} else { |
10 |
||
11 |
$query = "SELECT * FROM Users |
|
|
15
by Daniel Johansson
Fixed stuffz |
12 |
WHERE loginName = '{$username}';"; |
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
13 |
$userinfo = $db->query($query); |
|
12.1.3
by Gustav Hatvigsson
fixed a fow errors. |
14 |
$fetch = $userinfo->fetchAll(); |
15 |
if ($fetch[0]['shadow'] == $password) { |
|
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
16 |
session_start(); |
|
15
by Daniel Johansson
Fixed stuffz |
17 |
$_SESSION['userName'] = $username; |
18 |
$_SESSION['userType'] = $fetch[0]['userType']; |
|
|
12.1.1
by Gustav Hatvigsson
Added a feild to the Useres database. |
19 |
} else { |
20 |
echo "Wrong password or user name"; |
|
21 |
}
|
|
22 |
sleep(.5); |
|
23 |
header("Location:./index.php"); |
|
24 |
||
25 |
}
|
|
26 |
?>
|