1 rizwank 1.1 <?php
2 require "./inc/connect.php";
3 require "./inc/authentication.php";
4
5 // Clean the data collected in the <form>
6 $loginUsername = mysqlclean($_POST, "Usr", 20, $connection);
7 $loginPassword = mysqlclean($_POST, "Pwd", 20, $connection);
8
9 session_start();
10
11 // Authenticate the user
12 if (authenticateUser($connection, $loginUsername, $loginPassword, $utbl))
13 {
14 // Register the loginUsername
15 $_SESSION["login"] = $loginUsername;
16
17 // Register the IP address that started this session
18 $_SESSION["loginIP"] = $_SERVER["REMOTE_ADDR"];
19
20 // Relocate back to the first page of the application
21 header("Location: index.php");
22 rizwank 1.1 exit;
23 }
24 else
25 {
26 // The authentication failed: setup a logout message
27 $_SESSION["message"] = "Could not connect to the application as '{$loginUsername}'";
28
29 // Relocate to the logout page
30 header("Location: login-screen.php?m=1");
31 exit;
32 }
33 ?>
|