-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
39 lines (38 loc) · 877 Bytes
/
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
<?php
$id = filter_input(INPUT_POST, 'id');
$username = filter_input(INPUT_POST, 'username');
$password = filter_input(INPUT_POST, 'password');
if (!empty($username)){
if (!empty($password)){
$host = "localhost";
$dbusername = "root";
$dbpassword = "G@m3r0pinthechat";
$dbname = "account";
// 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 new_table (username, password)
values ('$username','$password')";
if ($conn->query($sql)){
echo "SUccess";
}
else{
echo "Error: ". $sql ."
". $conn->error;
}
$conn->close();
} }
else{
header('location:pdo_login.php');
die();
} }
else{
header('location:pdo_login.php');
die();
}
header('location:pdo_login.php');
?>