-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
45 lines (43 loc) · 1.53 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
<?php
include 'include/db_config.php';
include 'include/header.php';
if (isset($_POST['signup'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$contactno = $_POST['contactno'];
$gender = $_POST['gender'];
$sql = mysql_query("SELECT * FROM profile WHERE contactno='$contactno'");
$rows = mysql_num_rows($sql);
if($rows==1){echo "<script>alert('Contect No. Already Exist');</script>";}
else{
$query = mysql_query("INSERT INTO profile SET username='$username',password='$password',contactno='$contactno',gender='$gender' ");
if($query){
$result = mysql_query("SELECT profileid FROM profile WHERE contactno ='".$contactno."' AND password='".$password."'");
$user = mysql_fetch_array($result);
$_SESSION["id"] = $user['profileid'];
//setcookie("profileid",$user['profileid'],time()+(86400*30),"/","",0);
echo "<script>alert('Successful');</script>";
header("Location: editdp.php?success");
}
else{
echo "<script>alert('Somthing Missing !!!');</script>";
header("Location: signup.php?error");
}
}
}
echo '
<div class="form"><center>
<form method="post" action="signup.php">
<input type="text" name="username" placeholder="User Name"/>
<input type="text" name="password" placeholder="Your Password"/>
<input type="text" name="contactno" placeholder="Mobile No"/>
<label>Gender</label>
<input type="radio" name="gender" value="male" checked> Male
<input type="radio" name="gender" value="female"> Female
<center>
<button type="submit" name="signup">SIGNUP</button>
</form>
</div>
';
include 'include/footer.php';
?>