-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveuser.php
More file actions
34 lines (26 loc) · 789 Bytes
/
saveuser.php
File metadata and controls
34 lines (26 loc) · 789 Bytes
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
<?php
//connectie met database maken
require_once 'includes/Database/database.php';
//print_r($_POST);
//var_dump($_FILES);
//check of data verstuurd is
if (isset($_POST['submit'])) {
//data uit formulier halen
$username = mysqli_escape_string($db, $_POST['username']);
$password1 = mysqli_escape_string($db, $_POST['password']); //password_hash -- password_verify
$password = password_hash($password1, PASSWORD_BCRYPT);
//data naar database versturen
$query = "INSERT INTO customers (username, password)
VALUES ('$username', '$password')";
mysqli_query($db, $query);
//database afsluiten
mysqli_close($db);
//terugsturen naar index.php
header('location: inlog.php');
exit;
}
else
{
header('location: createuser.php');
}
?>