Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('connection.php');
- //perform check on username and password
- if(isset($_POST['username']) && isset($_POST['password'])){
- if (!empty($_POST['username']) && !empty($_POST['password'])) {
- $username = $_POST["username"];
- $password = $_POST["password"];
- $sql = "SELECT employeeID, username, password, manager FROM employees WHERE username = '$username' LIMIT 1";
- $result = mysqli_fetch_object(mysqli_query($conn, $sql));
- if($result->password == $password){
- $_SESSION['logged'] = true;
- $_SESSION['username'] = $username;
- $_SESSION['manager'] = $result->manager;
- $_SESSION['userID'] = $result->employeeID;
- header('Location: index.php');
- /*
- if ($result->manager == 0) {
- header('Location: user_report.php');
- }
- elseif ($result->manager == 1) {
- header('Location: view_user_reports.php');
- }
- elseif ($result->manager == 2) {
- header('Location: view_user_reports.php');
- }
- elseif ($result->manager == 3) {
- header('Location: view_user_reports.php');
- }*/
- }
- else{
- echo "Wrong email and/or password.";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement