-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnect.php
More file actions
36 lines (35 loc) · 822 Bytes
/
connect.php
File metadata and controls
36 lines (35 loc) · 822 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
35
36
<?php
$Username = filter_input(INPUT_POST, 'Username');
$passw = filter_input(INPUT_POST, 'passw');
if (!empty($Username)){
if (!empty($passw)) {
$host="localhost";
$dbusername="root";
$dbpassword="";
$dbname="emplois";
//create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()) {
die('Connect Error('.mysqli_connect_error().')'.mysqli_connect_error);
}
else {
$sql = "INSERT INTO admin (id,nom ,prenom,sexe,password,login) values ('2','$Username','$passw','','','')";
if ($conn->query($sql)){
echo " record is inserted succesufly";
}else
{
echo"error".$sql."<br>".$conn->error;
}
$conn->close();
}
}
else {
echo "passw should not be empty";
die();
}
}
else {
echo "Username should not be empty";
die();
}
?>