diff --git a/login.php b/login.php index 6ebb8d2..e6ed1f0 100644 --- a/login.php +++ b/login.php @@ -7,33 +7,29 @@
15)); +$password = $_POST['password']; + if ($con->connect_errno > 0){ die ('Unable to connect to database [' . $db->connect_errno . ']'); } -$sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$passhash'"; -if ($result = $con->query($sqllogin)){ - $row_cnt = mysqli_num_rows($result); - if ($row_cnt > 0){ - while ($row = $result->fetch_array()){ - $uname = $row['username']; - $uid = $row['userid']; - $_SESSION['username'] = $uname; - $_SESSION['userid'] = $uid; - } - header("refresh:1;url=index.php"); - echo 'You have successfully logged in ...
Returning to index in a few seconds
'; - } else { - echo 'That was not a valid username or password!

'; - echo 'Please try again here'; - } +$sqluname = "select * from userinfo where username = '$username'"; +$result = mysqli_query($con, $sqluname); +$row = mysqli_fetch_row ($result); +$verifypass = password_verify ($password,$row[2]); +if ($verifypass) { + $_SESSION['userid'] = $row[0]; + $_SESSION['username'] = $row[1]; + $_SESSION['usermail'] = $row[3]; + $_SESSION['admin'] = $row[4]; + include_once ('header.php'); + header("refresh:1;url=index.php"); + echo '
You have successfully logged in!
'; +} else { + echo 'The username or password provided don\'t match!
Please try again
'; + exit(); } -include_once ('footer.php'); ?> \ No newline at end of file diff --git a/logout.php b/logout.php index 4c3a5d9..d6f89d4 100644 --- a/logout.php +++ b/logout.php @@ -15,5 +15,4 @@ if ($logout == "logout"){ } else { echo '
Something went wrong, you haven\'t been logged out!

Please click HERE to try again
'; } -include_once ('footer.php'); ?> \ No newline at end of file diff --git a/style.css b/style.css index e28db87..9e4c799 100644 --- a/style.css +++ b/style.css @@ -10,9 +10,11 @@ a.navlink:link { color: #003366; font-weight: bold; text-decoration: none; } a.navlink:visited { color: #003366; font-weight: bold; text-decoration: none; } a.navlink:hover { color: #CCCCCC; font-weight: bold; text-decoration: none; } -td { +table td { font-family: Tahoma; font-size: 13px; + display: table-cell; vertical-align: center; + text-align: center; } .title {