-
Notifications
You must be signed in to change notification settings - Fork 0
/
insertUsers.php
79 lines (75 loc) · 3.28 KB
/
insertUsers.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
$connexion = new mysqli('localhost', 'root', '', 'objetsparles');
if ($connexion->connect_errno) {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
} else {
$sql = 'INSERT INTO `user` (`firstName`, `lastName`, `username`, `password`, `ADMIN`) VALUES (?, ?, ?, ?, ?)';
if ($stmt = $connexion->prepare($sql)) {
$stmt->bind_param('ssssi', $firstName, $lastName, $username, $hashpassword, $admin);
$firstName = 'Jonelle';
$lastName = 'Amio';
$username = 'jamio';
$password = 'root';
$hashpassword = password_hash($password, PASSWORD_DEFAULT);
$admin = '1';
if ($stmt->execute()) {
echo ("username : $firstName inseréééée <br/>");
} else {
//echo($stmt);
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
if ($stmt = $connexion->prepare($sql)) {
$stmt->bind_param('ssssi', $firstName, $lastName, $username, $hashpassword, $admin);
$firstName = 'Mael';
$lastName = 'Giese';
$username = 'mgiese';
$password = '1000';
$hashpassword = password_hash($password, PASSWORD_DEFAULT);
$admin = '1';
if ($stmt->execute()) {
echo ("username : $firstName inseréééée <br/>");
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
if ($stmt = $connexion->prepare($sql)) {
$stmt->bind_param('ssssi', $firstName, $lastName, $username, $hashpassword, $admin);
$firstName = 'Yorik';
$lastName = 'Deroche';
$username = 'yderoche';
$password = 'root';
$hashpassword = password_hash($password, PASSWORD_DEFAULT);
$admin = '1';
if ($stmt->execute()) {
echo ("username : $firstName inseréééée <br/>");
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
if ($stmt = $connexion->prepare($sql)) {
for ($i=0; $i < 4; $i++) {
$stmt->bind_param('ssssi', $firstName, $lastName, $username, $hashpassword, $admin);
$firstName = 'firstname'. $i;
$lastName = 'lastname'. $i;
$username = 'username'. $i;
$password = 'password'. $i;
$hashpassword = password_hash($password, PASSWORD_DEFAULT);
$admin = '0';
if ($stmt->execute()) {
echo ("username : $firstName inseréééée <br/>");
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
}
} else {
echo ("Echec de connexion n°{$connexion->connect_errno} : {$connexion->connect_error}");
}
}
?>