/extremedating/trunk

To get this branch, use:
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";
52.1.2 by Gustav Hatvigsson
Seperated out the salt into its own file.
3
include "php/salt.php";
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
4
52.1.2 by Gustav Hatvigsson
Seperated out the salt into its own file.
5
$password = sha1($_POST['password'].$pwd_salt);
26 by Daniel Johansson
Fixed sessions for logins
6
$username = $_POST['username'];
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
7
26 by Daniel Johansson
Fixed sessions for logins
8
if(isset($_SESSION ['userName'])) {
15 by Daniel Johansson
Fixed stuffz
9
  echo "You can not login whilest you are logedin...";
66 by Gustav Hatvigsson
* Made login re-direct if the a user is logedin
10
  header("Location:./index.php"); 
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
11
} else {
12
13
  $query = "SELECT * FROM Users
15 by Daniel Johansson
Fixed stuffz
14
  WHERE loginName = '{$username}';";
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
15
  $userinfo = $db->query($query);
12.1.3 by Gustav Hatvigsson
fixed a fow errors.
16
  $fetch = $userinfo->fetchAll();
17
  if ($fetch[0]['shadow'] == $password) {
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
18
      session_start();
15 by Daniel Johansson
Fixed stuffz
19
      $_SESSION['userName'] = $username;
20
      $_SESSION['userType'] = $fetch[0]['userType'];
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
21
  } else {
22
    echo "Wrong password or user name";
23
  }
24
  sleep(.5);
65 by Gustav Hatvigsson
made it possible to decline and accept dates
25
  header("Location:./index.php"); 
12.1.1 by Gustav Hatvigsson
Added a feild to the Useres database.
26
}
27
?>