-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathregistration.php
46 lines (37 loc) · 1.2 KB
/
registration.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
<?php
session_start();
include('include/db_connect.php');
$Username= $_POST['Username'];
$Password = $_POST['Password'];
$Email = $_POST['Emailid'];
$Phoneno = $_POST['Phonenumber'];
$Country=$_POST['Country'];
$Gender = $_POST['Gender'];
$Username_checking = "select * from Signup where Username='$Username'" ;
$result = mysqli_query($con, $Username_checking);
$num = mysqli_num_rows($result);
if ($Gender=='Male'){
$profileimg='images/men.jpg';
}
else{
$profileimg='images/women.jpg';
}
if($num==1)
{
echo '<script>alert("username already taken")</script>';
echo '<script>window.open("login.html","_self")</script>';
exit();
}
else
{
$reg="insert into Signup(Username,Password,Email,Phoneno,Country,Gender,Profile,Wallpaper) values ('$Username','$Password','$Email','$Phoneno','$Country','$Gender','$profileimg','f2f2f2')";
$query=mysqli_query($con,$reg);
if($query){
echo '<script>alert("Congratulations ,Your account has been created ")</script>';
echo '<script>window.open("login.html","_self")</script>';
}
else{
echo '<script>alert("Registration Failed ,Try Again!!..")</script>';
}
}
?>