diff --git a/index.php b/index.php index b7e1759..b94b384 100644 --- a/index.php +++ b/index.php @@ -68,7 +68,9 @@ diff --git a/inventory.php b/inventory.php index 443e41f..687b3fb 100644 --- a/inventory.php +++ b/inventory.php @@ -1,7 +1,5 @@ @@ -315,7 +313,4 @@ class="button button--flex button--small button--link services__button" \ No newline at end of file diff --git a/login.php b/login.php index 93e182d..79c1c91 100644 --- a/login.php +++ b/login.php @@ -1,28 +1,37 @@ alert('Good bye!');window.location= 'index.php' "; ?> \ No newline at end of file diff --git a/session.php b/session.php index f490c66..079adf9 100644 --- a/session.php +++ b/session.php @@ -2,43 +2,12 @@ include('conn.php'); include('superuser.php'); -$start = 0; +session_start(); -if(!isset($_COOKIE['user']) || !isset($_COOKIE['pass']) || ($_COOKIE['user']=='') || ($_COOKIE['pass']=='')){ +if(!isset($_SESSION['user']) || !isset($_SESSION['pass'])){ header("Location: index.php"); - } - else{ - $user = $_COOKIE["user"]; - $pass = $_COOKIE["pass"]; - - $query = mysqli_query($conn,"SELECT `user`, `pass` FROM `users` WHERE user='$user' AND pass='$pass'"); - $nr = mysqli_num_rows($query); - - - if ($nr == 1){ - $start = 3; - - $query2 = mysqli_query($conn,"SELECT `id`, `admin` FROM `users` WHERE user = '$user'"); - $row=mysqli_fetch_array($query2); - - if ($row['admin'] == true){ - $start = 2; - - if ($row['id'] == $superuser){ - $start = 1; - } - } - } - else if ($nr == 0){ - $cookie_name = "user"; - $cookie_value = ''; - setcookie($cookie_name, $cookie_value, time() + (86400), "/"); - - $cookie_name = "pass"; - $cookie_value = ''; - setcookie($cookie_name, $cookie_value, time() + (86400), "/"); - - echo ""; - } +} else { + $user=$_SESSION['user']; + $start=$_SESSION["start"]; } ?> \ No newline at end of file