- Home
- Categorie
- Coding e Sistemistica
- PHP
- login con password verify
-
login con password verify
salve e ben ritrovati ho un problema non riesco a far funzionare il login con la password verify dove sbaglio? posto il codice
<?php require('db.php'); session_start(); // When form submitted, check and create user session. if (isset($_POST['username'])) { $username = stripslashes($_REQUEST['username']); // removes backslashes $username = mysqli_real_escape_string($con, $username); $password = stripslashes($_REQUEST['password']); $password = '$password'; // password inserita dall'utente nel login if (password_verify($password, $password)) { } // Check user is exist in the database $query = "SELECT * FROM `users` WHERE username='$username' AND password='$password'"; $result = mysqli_query($con, $query) or die(mysql_error()); $rows = mysqli_num_rows($result); if ($rows == 1) { $_SESSION['username'] = $username; // Redirect to user dashboard page header("Location: dashboard.php"); } else { echo "<div class='form'> <h3>Incorrect Username/password.</h3><br/> <p class='link'>Click here to <a href='login.php'>Login</a> again.</p> </div>"; } } else { ?> <form class="form" method="post" name="login"> <h1 class="login-title">Login</h1> <input type="text" class="login-input" name="username" placeholder="Username" autofocus="true"/> <input type="password" class="login-input" name="password" placeholder="Password"/> <input type="submit" value="Login" name="submit" class="login-button"/> <p class="link">Don't have an account? <a href="registration.php">Registration Now</a></p> </form>
-
risolto con un altro codice