Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="navstyle.css">
- </head>
- <body>
- <div class="topnav">
- <a href="home.php">Home</a>
- <a class="active" href="a_login.php">News</a>
- <a href="a_contact.php">Contact</a>
- <a href="a_about.php">About</a>
- </div>
- <div class="maincontainer">
- <form action="" method="post">
- <label>email:</label> <input type="text" name="emailinput"><br>
- <label>password:</label> <input type="password" name="passwdinput"><br>
- <input type="submit" type="submit" name="submit" value="hi">
- </form>
- <?php
- if(isset($_POST['submit'])) {
- $mysqli = new mysqli("localhost", "root", "", "dbUsers");
- if ($mysqli->connect_errno) {
- echo $mysqli->connect_errno;
- exit;
- }
- $emailsubmit =$_POST["emailinput"];
- $passwdsubmit = $_POST["passwdinput"];
- $hash = password_hash($passwdsubmit,PASSWORD_DEFAULT);
- $authUser = $mysqli->query("SELECT * FROM tblUser WHERE email = '$emailsubmit'");
- if ($authUser->num_rows ==1){
- $userResults = $authUser->fetch_assoc();
- if (password_verify($passwdsubmit,$userResults['passwd'])) {
- echo "<p> working </p>";
- } else {
- echo "<p>not working</p>";
- }
- }
- }
- ?>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment