-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconnect.php
43 lines (42 loc) · 1.45 KB
/
connect.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
<?php
$name = filter_input(INPUT_POST, 'nname');
$username = filter_input(INPUT_POST, 'uname');
$email = filter_input(INPUT_POST, 'ename');
$password = filter_input(INPUT_POST, 'pname');
if (!empty($name)) {
if (!empty($username)) {
if (!empty($email)) {
if (!empty($password)) {
$host = "localhost";
$dbusername = "root";
$dbpassword = "";
$dbname = "cart";
// Create connection
$conn = new mysqli($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
} else {
$sql = "INSERT INTO registration (name, username, email, password) values ('$name','$username','$email','$password')";
if ($conn->query($sql)) {
header("location: register.php");
} else {
echo "Error: " . $sql . "" . $conn->error;
}
$conn->close();
}
} else {
header("location: register.php");
die();
}
} else {
header("location: register.php");
die();
}
} else {
header("location: register.php");
die();
}
} else {
header("location: register.php");
die();
}