Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- session_start();
- include("config.php");
- $conexion = new mysqli($host_db, $user_db, $pass_db, $db_nam
- if ($conexion->connect_error) {
- die("La conexion falló: " . $conexion->connect_error);
- }
- $username = $_POST['username']; //read the usernamein index.html
- $password = $_POST['password']; //read the password in index.html
- $sql = "SELECT * FROM $tbl_name WHERE usuario = '$username'";
- $result = $conexion->query($sql);
- if ($result->num_rows > 0) {
- }
- $row = $result->fetch_array(MYSQLI_ASSOC);
- if (password_verify($password, $row['password'])) {
- $_SESSION['loggedin'] = true;
- $_SESSION['username'] = $username;
- $_SESSION['start'] = time();
- $_SESSION['expire'] = $_SESSION['start'] + (5 * 60);
- echo "Bienvenido! " . $_SESSION['username'];
- echo "<br><br><a href=panel-control.php>Panel de Control</a>";
- } else {
- echo "Username or Password incorrect.";
- echo "<br><a href='../index.html'>Try Again</a>";
- }
- mysqli_close($conexion);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement