-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert_hash_password.php
40 lines (32 loc) · 1.08 KB
/
insert_hash_password.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE PHP>
<?php
include('conn.php');
$username = "admin2";
$password = "password123456";
// echo "start ";
$query = "INSERT INTO adminuser (username, password) VALUES (?, ?)";
// $stmt->bind_param("sss",$username,$password);
if ($stmt = mysqli_prepare($db, $query)) {
// echo "inside ";
/* execute statement */
// mysqli_stmt_execute($stmt);
mysqli_stmt_bind_param($stmt, "ss", $param_username, $param_password);
$param_username = $username;
$param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt))
// echo "success";
/* bind result variables */
// mysqli_stmt_bind_result($stmt, $admin_username, $admin_password);
/* fetch values */
// mysqli_stmt_fetch($stmt);
echo "done";
// if($username == $admin_username && $password == $admin_password)
// echo "hey";
// else
// echo "not recognised";
/* close statement */
mysqli_stmt_close($stmt);
}
mysqli_close($db);
?>