-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
92 lines (44 loc) · 1.45 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
<center>
<h1>No Signups Yet</h1>
</center>
<?php
include'db.php';
$id = $_POST['id'];
$firstpass = $_POST['pass'];
$secondpass = $_POST['pass2'];
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$connection = mysqli_connect($host_name, $user_name, $password, $database) or die(mysqli_error);
$pass = $firstpass;
$sql = "select * from users where username = '$id'";
$recordSet = mysqli_query($connection,$sql);
if($firstpass==$secondpass){
if($id == null or $pass == null){
echo"<center>";
echo"<h1>Null VALUES are Unacceptable</h1>";
echo"<a href='signup.html'>Try again</a>";
echo"<center>";
} else if ($record = mysqli_fetch_array($recordSet, MYSQLI_ASSOC)){
echo"<center>";
echo"<h1>ACCOUNT EXISTS</h1>";
echo"<a href='signup.html'>Try again</a>";
echo"</center>";
} else {
$sql= "insert into users (username,password,first,last,email) VALUES ('$id','$pass','$first','$last','$email')";
mysqli_query($connection,$sql);
mkdir("/var/www/html/webday/name/$id",0777,true);
echo"<center>";
echo"<h1>ACCOUNT CREATED</h1>";
echo"<h1><a href='login.html'>Login</a></h1>";
echo"</center>";
};
}else{
echo"<center>";
echo"<h1>PASSWORDS DO NOT MATCH</h1>";
echo"<a href='signup.html'>Try again</a>";
echo"<center>";
};
mysqli_free_result($record);
mysqli_close($connection);
?>