Skip to content
Snippets Groups Projects
Commit 394bbaf9 authored by Iqbal's avatar Iqbal
Browse files

Added hashing for password.

parent 20d8924a
No related merge requests found
......@@ -21,8 +21,9 @@
}
if (isset($_POST['username'])) {
if ($userData[$_POST['username']] === $_POST['password']) {
if ($userData[$_POST['username']] === md5($_POST['password'])) {
$_SESSION['username'] = $_POST['username'];
//header untuk redirect
echo "<script type='application/javascript'> alert('Login berhasil'); </script>";
} else {
echo "<script type='application/javascript'> alert('Username atau password salah'); </script>";
......
......@@ -9,12 +9,14 @@
include_once "Controller.php";
include_once "../model/User.php";
$hashedPassword = md5($_POST['password']);
$newUser = array(
"id" => 0,
"name" => $_POST['name'],
"username" => $_POST['username'],
"email" => $_POST['email'],
"password" => $_POST['password'],
"password" => $hashedPassword,
"phone" => $_POST['phone'],
"photo" => "http://www.simian-risk.com/wp-content/themes/custom/images/empty-profile.png",
"is_driver" => 0
......@@ -26,6 +28,5 @@
$pdo = DB::getInstance();
User::InsertUser($newUser, $pdo);
$allUser = User::GetAllUsernameAndPassword($pdo);
print_r($allUser);
\ No newline at end of file
//header untuk redirect
echo "<script> alert('Registrasi berhasil.');</script>";
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment