-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.php
163 lines (151 loc) · 14.8 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
require "header.php";
?>
<?php
if(isset($_POST['signup-submit'])){
require './includes/dbh.inc.php';
require_once './includes/emailController.inc.php';
header("LOCATION: signup.php?hahah");
$username = $_POST['uid'];
$email = $_POST['mail'];
$password = $_POST['pwd'];
$passwordRepeat = $_POST['pwd-repeat'];
$mobNumber = $_POST['mobnum'];
$address = $_POST['address'];
$state = $_POST['state'];
$country = $_POST['country'];
$file = $_FILES['file'];
//print_r($file);
$fileName = $_FILES['file']['name'];
$fileTmpName = $_FILES['file']['tmp_name'];
//print_r($fileTmpName);
$folder = "user/userimages/".$fileName;
move_uploaded_file($fileTmpName, $folder);
if(empty($mobNumber) || empty($username) || empty($email) || empty($password) || empty($passwordRepeat) ){
header("Location: signup.php?error=emptyfield");
exit();
}
elseif($password !== $passwordRepeat ){
header("Location: signup.php?error=passwordcheck");
exit();
}
else {
$sql = "SELECT uidUsers FROM users WHERE uidUsers='$username'";
$checkusername = mysqli_query($conn, $sql);
$countusername = mysqli_num_rows($checkusername);
$sqlemail = "SELECT uidUsers FROM users WHERE emailUsers='$email'";
$checkemail = mysqli_query($conn, $sqlemail);
$countemail = mysqli_num_rows($checkemail);
if(($countemail && $countusername) > 0){
header("Location: signup.php?error=useremailtaken");
exit();
}
elseif($countemail > 0){
header("Location: signup.php?error=emailtaken");
exit();
}
elseif($countusername > 0){
header("Location: signup.php?error=usertaken");
exit();
}
else{
$hashedPwd = password_hash($password, PASSWORD_DEFAULT);
$sql = "INSERT INTO users VALUES (NULL ,'$username', '$email', '$hashedPwd', '$mobNumber', '$address', '$state', '$country', '$folder')";
$check = mysqli_query($conn, $sql);
if($check){
header("Location: signup.php?signup=success");
}
}
}
}
?>
<body class="bg-color">
<div class="d-flex section">
<div class="imagebox">
<div class=" container">
<svg id="e1675d86-3465-436e-a974-bad49a6f132e" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="450" height=890 viewBox="0 0 760 693.82363"><title>upload image</title><ellipse cx="185" cy="248.5" rx="52" ry="63.5" fill="#2f2e41"/><path d="M361.5,756.3515l-30,3s-10,18-28,18-12,20,14,18,54-9,55-11S369.5,755.3515,361.5,756.3515Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M361.5,756.3515l-30,3s-10,18-28,18-12,20,14,18,54-9,55-11S369.5,755.3515,361.5,756.3515Z" transform="translate(-220 -102.8515)" opacity="0.1"/><path d="M319.5,581.3515s34,5,47,21,4-61,4-61l-4-35-27,2-22,45Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M319.5,581.3515s34,5,47,21,4-61,4-61l-4-35-27,2-22,45Z" transform="translate(-220 -102.8515)" opacity="0.1"/><path d="M431.5,381.3515s16-44,0-45-14,43-14,43Z" transform="translate(-220 -102.8515)" fill="#a0616a"/><path d="M5,131H37.49213A2.50787,2.50787,0,0,1,40,133.50787v13.98425A2.50787,2.50787,0,0,1,37.49213,150H5a0,0,0,0,1,0,0V131A0,0,0,0,1,5,131Z" fill="#28ab87"/><path d="M2.64567,131H35.49213A2.50787,2.50787,0,0,1,38,133.50787v13.98425A2.50787,2.50787,0,0,1,35.49213,150H2.64567A2.64567,2.64567,0,0,1,0,147.35433V133.64567A2.64567,2.64567,0,0,1,2.64567,131Z" fill="#2f2e41"/><circle cx="30" cy="140" r="2" fill="#28ab87"/><path d="M247.5,256.3515s-25-48-27-25,13,42,13,42Z" transform="translate(-220 -102.8515)" fill="#a0616a"/><path d="M393.01114,371.441S415,372.8515,417,384.8515s-16,49-16,49l-24-2-3-24Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M365.5,336.3515s8,41-18,24,10,30,10,30,28,7,37-2-13.5-10.5-1-46C406.93773,304.18833,365.5,336.3515,365.5,336.3515Z" transform="translate(-220 -102.8515)" fill="#a0616a"/><path d="M365.5,336.3515s8,41-18,24,10,30,10,30,28,7,37-2-13.5-10.5-1-46C406.93773,304.18833,365.5,336.3515,365.5,336.3515Z" transform="translate(-220 -102.8515)" opacity="0.1"/><path d="M277,476.8515s22.5,163.5,29.5,173.5,31,100,31,100l26-9a119.77482,119.77482,0,0,1-1-33c2-18-15-66-15-66l-25-148Z" transform="translate(-220 -102.8515)" fill="#2f2e41"/><path d="M277,476.8515s22.5,163.5,29.5,173.5,31,100,31,100l26-9a119.77482,119.77482,0,0,1-1-33c2-18-15-66-15-66l-25-148Z" transform="translate(-220 -102.8515)" opacity="0.1"/><path d="M271.5,469.3515l22,63s-46,83-8,110c0,0,44,48,48,90,0,0,23-2,26-20,0,0-21-46-22-62s-24-35-24-35,44-71,54-83,11-58-14-58S271.5,469.3515,271.5,469.3515Z" transform="translate(-220 -102.8515)" fill="#2f2e41"/><path d="M357.5,712.3515s-17,21-22,18c0,0-4,43-13,55s19,11,29,0,29-53,29-58S363.5,709.3515,357.5,712.3515Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><circle cx="162.5" cy="223.5" r="27" fill="#a0616a"/><path d="M353.5,358.3515s1,17,16,21,27-6,27-6l4,8-13,32-24,78s-71,10-77-7,10-65,10-65l23-33,9-22,10-11Z" transform="translate(-220 -102.8515)" fill="#28ab87"/><path d="M359.5,362.3515s-15.5-15.5-25.5-15.5-18.5-6.5-18.5-6.5-33,48-53,106-48,76-34,90,36,11,45,26,9,13,15-10-1-86,28-113S359.5,362.3515,359.5,362.3515Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M318.5,343.3515s-40-36-45-51-24-43-28-39-26,13-21,20,17,16,24,41,56,57,56,57Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M391.5,371.3515s-17,1-27,54-9,177,0,187c0,0,9,11,10-9s16-113,12-137,5-76,18-85S391.5,371.3515,391.5,371.3515Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M382.5,415.3515s33,15,32,26-2,33-43-3Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><path d="M394.5,415.3515s-14,33,4,39,23-28,23-28,14-38,13-46-21-9-23-4S394.5,415.3515,394.5,415.3515Z" transform="translate(-220 -102.8515)" fill="#3f3d56"/><ellipse cx="185" cy="251" rx="12" ry="44" fill="#2f2e41"/><ellipse cx="176" cy="201.5" rx="36" ry="17.5" fill="#2f2e41"/><path d="M399,319.8515c-19.88226,0-36-7.835-36-17.5,0-3.408,2.01093-6.58606,5.47729-9.2757C363.19122,296.12158,360,300.05456,360,304.3515c0,9.665,16.11774,17.5,36,17.5C408.87158,321.8515,410.04285,319.8515,399,319.8515Z" transform="translate(-220 -102.8515)" opacity="0.1"/><path d="M444.61287,670.11667a20.81252,20.81252,0,1,0,8.3387-39.13277l-.98562,10.67947-3.7314-9.80018a20.73405,20.73405,0,0,0-12.22123,10.10949,20.4084,20.4084,0,0,0-1.97438,5.40651A20.80854,20.80854,0,0,0,444.61287,670.11667Z" transform="translate(-220 -102.8515)" fill="#57b894"/><path d="M452.0289,796.6485c-.49451-9.27109,8.31332-16.18134,16.63109-20.306s17.89981-7.97772,21.73547-16.43263c5.51252-12.15118-3.91862-25.329-11.121-36.56135a125.3002,125.3002,0,0,1-12.91856-26.63091c-1.29809-3.75147-2.42859-7.64108-2.34816-11.61.11584-5.71565,2.71274-11.052,5.29035-16.15471q12.88016-25.49811,26.95418-50.36938" transform="translate(-220 -102.8515)" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><path d="M445.84808,667.50609a20.81252,20.81252,0,1,0,8.33869-39.13278l-.98561,10.67948-3.7314-9.80018a20.734,20.734,0,0,0-12.22123,10.10949,20.40859,20.40859,0,0,0-1.97439,5.4065A20.80855,20.80855,0,0,0,445.84808,667.50609Z" transform="translate(-220 -102.8515)" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><path d="M475.60841,611.92507a20.78824,20.78824,0,0,1,16.68183-10.96779l.26936,10.32343,4.64475-10.1448a20.81,20.81,0,1,1-21.59594,10.78916Z" transform="translate(-220 -102.8515)" fill="#57b894"/><path d="M477.25535,608.4443a20.78823,20.78823,0,0,1,16.68183-10.9678l.26936,10.32344,4.64475-10.14481a20.81,20.81,0,1,1-21.59594,10.78917Z" transform="translate(-220 -102.8515)" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><path d="M475.62817,723.04085a20.81,20.81,0,0,0,23.42627-34.07564l-3.56911,7.796-.2698-10.44473a.3639.3639,0,0,0-.04963-.02732,20.81113,20.81113,0,1,0-19.53773,36.75172Z" transform="translate(-220 -102.8515)" fill="#57b894"/><path d="M477.13066,719.49173a20.81,20.81,0,0,0,23.42627-34.07565l-3.56912,7.796-.26979-10.44474a.36409.36409,0,0,0-.04964-.02732,20.81113,20.81113,0,1,0-19.53772,36.75173Z" transform="translate(-220 -102.8515)" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><path d="M449.33088,754.22551a20.80131,20.80131,0,1,0,6.25521-15.57438l7.225,15.11843-11.50663-9.11037A20.61639,20.61639,0,0,0,449.33088,754.22551Z" transform="translate(-220 -102.8515)" fill="#57b894"/><path d="M450.56608,751.61493a20.80131,20.80131,0,1,0,6.25521-15.57438l7.225,15.11842-11.50663-9.11037A20.61655,20.61655,0,0,0,450.56608,751.61493Z" transform="translate(-220 -102.8515)" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><line x1="4.5" y1="691.5" x2="411.5" y2="691.5" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><rect x="348.5" y="113.5" width="298" height="196" fill="#f2f2f2"/><rect x="276.5" y="0.5" width="483" height="381" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><line x1="277" y1="22.5" x2="760" y2="22.5" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><circle cx="286.5" cy="12.5" r="5" fill="#f86b75"/><circle cx="300.5" cy="12.5" r="5" fill="#fad375"/><circle cx="314.5" cy="12.5" r="5" fill="#8bcc55"/><circle cx="288.5" cy="9.5" r="5" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><circle cx="302.5" cy="9.5" r="5" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><circle cx="316.5" cy="9.5" r="5" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><rect x="372" y="92" width="298" height="196" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><rect x="610" y="331" width="55" height="15" fill="#28ab87"/><rect x="615" y="327" width="55" height="15" fill="none" stroke="#3f3d56" stroke-miterlimit="10"/><path d="M744.39019,309.39759,721.3807,285.68408a5.23007,5.23007,0,0,0-3.84636-1.54541h-.06868a5.23011,5.23011,0,0,0-3.84637,1.54541l-23.00948,23.71351a5.07766,5.07766,0,0,0,0,7.418,5.67964,5.67964,0,0,0,7.7614,0l13.634-14.25215v36.7465a5.5003,5.5003,0,0,0,10.9896,0v-36.7465l13.634,14.25215a5.67965,5.67965,0,0,0,7.76141,0,5.07766,5.07766,0,0,0,0-7.418Z" transform="translate(-220 -102.8515)" fill="#28ab87"/></svg>
</div>
</div>
<div class="content container">
<div style="padding-top:50px;">
<h1 class="mt-lg text-center mb-1">Sign UP</h1>
<div class="text-center container">
<div class="container">
<hr>
</div>
</div>
<div class="container text-center">
<?php
if (isset($_GET["signup"])){
if($_GET["signup"] == "success" ){
echo'<p style="color:green; font-size:14px;" class="signupsuccess">Signup Successfull!</p>';
}
}
elseif (isset($_GET["error"])){
if($_GET["error"] == "invalidmobilenumber")
{
echo'<p style="color:red; font-size:14px;">Invalid mob number</p>';
}
elseif($_GET["error"] == "emptyfield"){
echo'<p style="color:red; font-size:14px;">Please fill in all the details. </p>';
}
elseif($_GET["error"] == "useremailtaken"){
echo'<p style="color:red; font-size:14px;">Username and Email taken</p>';
}elseif($_GET["error"] == "emailtaken"){
echo'<p style="color:red; font-size:14px;">Email taken</p>';
}
elseif($_GET["error"] == "usertaken"){
echo'<p style="color:red; font-size:14px;">Username taken</p>';
}
elseif ($_GET["error"] == "passwordcheck") {
echo'<p style="color:red; font-size:14px;" class="text-center">Password is not matching</p>';
}
}
?>
</div>
<form action="" method="post" enctype="multipart/form-data">
<div class="text-center">
<div>
<input class="input-field" type="text" name="uid" placeholder="Username"/>
</div>
<div>
<input class="input-field" type="email" name="mail" placeholder="Email"/>
</div>
<div>
<input class="input-field" type="text" name="mobnum" placeholder="Enter your mobile number...">
</div>
<div>
<input class="input-field" type="password" name="pwd" placeholder="Password">
</div>
<div>
<input class="input-field" type="password" name="pwd-repeat" placeholder="Repeat password">
</div>
<div>
<input class="input-field" rows="10" cols="30" type="textarea" name="address" placeholder="Enter your address..." >
</div>
<div>
<input class="input-field" type="text" placeholder="Enter your state..." name='state'>
</div>
<div class="p-1">
<select name="country" id="">
<option value="">Select your country</option>
<option value="india">India</option>
<option value="australia">Australia</option>
<option value="pakistan">Pakistan</option>
<option value="japan">Japan</option>
</select>
</div>
<input type="hidden" name="size" value="1000000">
<div class="p-1">
<input class="chse_file" type="file" name="file">
</div>
<div class="text-center my-1">
<button style="width:150px; font-size:20px;background:#28AB87" class="btn button-field text-deco-none" type="submit" name="signup-submit">
Signup
</button>
</div>
</form>
</div>
</div>
</div>
</body>