- Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.18, 7.3.0 - 7.3.5
- └[∵]┐└[∵]┘┌[∵]┘└[∵]┐└[∵]┘┌[∵]┘
<?php
$error = '';
if ($_POST) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = "<span>Please fill the required fields</span>";
}
$hashed_password = password_hash("disco313", PASSWORD_DEFAULT);
//Connect to database
$host = "";
$dbname = "";
$user = "";
$pass = "";
$charset = "UTF8MB4"; // if your db does not use CHARSET=UTF8MB4, you should probably be fixing that
$dsn = "mysql:host={$host};dbname={$dbname};charset={$charset}";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // highly recommended
PDO::ATTR_EMULATE_PREPARES => false // ALWAYS! ALWAYS! ALWAYS!
];
$db = new PDO($dsn, $user, $pass, $options);
$stmnt = $db->prepare(
"SELECT * FROM register WHERE 'username' = :username AND 'password' = :password");
if ($stmt->execute($stmnt) ){
session_start();
header('Location: http://localhost/Scmr/php/Home.php');
} else {
$error = "<span>Please enter the correct username and password</span>";
}
}
echo "└[∵]┐└[∵]┘┌[∵]┘└[∵]┐└[∵]┘┌[∵]┘" ;
exit;