diff --git a/login.php b/login.php new file mode 100644 index 0000000..278f9c9 --- /dev/null +++ b/login.php @@ -0,0 +1,37 @@ + + + + +Logging in + + +
+connect_errno > 0){ + die ('Unable to connect to database [' . $db->connect_errno . ']'); +} +$sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$password'"; +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'; + } +} +include_once ('footer.php'); +?> \ No newline at end of file