-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
46 lines (41 loc) · 1.27 KB
/
test.php
File metadata and controls
46 lines (41 loc) · 1.27 KB
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
$username=$_POST['username'];
$password=$_POST['password'];
$gender=$_POST['gender'];
$email=$_POST['Email'];
$phonecode=$_POST['phonecode'];
$phone=$_POST['phone'];
if (!empty($username) || !empty($password) || !empty($gender) || !empty($Email) || !empty($phonecode) || !empty($phone)) {
$host="localhost";
$dbusername="root";
$dbpassword="";
$dbname="register";
$conn =new mysqli($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()) {
die('connect error('. mysqli_connect_error().')'. mysqli_connect_error());
} else {
$SELECT="SELECT email From register where email=? limit 1";
$INSERT="INSERT into register(username,password,gender,Email,phonecode,phone) values(? ,?, ?, ?, ?, ?,?)";
$stmt=$conn->prepare($SELECT);
$stmt->bind_param("s",$Email);
$stmt->execute();
$stmt->bind_result($Email);
$stmt->store_result();
$rnum=$stmt->num_rows;
if ($rnum==0) {
$stmt->close();
$stmt=$conn->prepare($INSERT);
$stmt->bind_param("ssssii",$username,$password,$gender,$Email,$phonecode,$phone);
$stmt->execute();
echo "New data inserted successfully";
}else{
echo "someone already register using this Email";
}
$stmt->close();
$conn->close();
}
}else{
echo "all field are requried";
die();
}
?>