-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
48 lines (38 loc) · 1.12 KB
/
signup.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
<?php
$username = htmlspecialchars( $_POST['username2'] );
$password = htmlspecialchars( $_POST['password2'] );
$passrepeat = htmlspecialchars( $_POST['passrepeat'] );
$email = htmlspecialchars( $_POST['email'] );
$conn = mysqli_connect("localhost", "root", "11182917", "cupping");
//$url = 'http://127.0.0.1:8080/cupping/docs/assets/index.html';
if($password!=$passrepeat)
{
echo "password is not matched with repeat word.";
exit();
}
if($username==NULL || $password==NULL || $passrepeat==NULL || $email==NULL)
{
echo $username;
echo $password;
echo $passrepeat;
echo $email;
echo "please fill up any empty boxes.";
exit();
}
$conn = mysqli_connect("localhost", "root", "11182917", "cupping");
$check = "SELECT * from user_info WHERE username='$username'";
$result = $conn->query($check);
if($result->num_rows == 1)
{
echo "duplicated id.";
exit();
}
$signup=mysqli_query($conn, "INSERT INTO user_info (username, password, email, created)
VALUES ( '$username', '$password', '$email', NOW())");
if($signup){
echo "sign up success";
header('refresh:2; url=signin.html');
} else {
echo "sign up failed";
}
?>