-
Notifications
You must be signed in to change notification settings - Fork 0
/
insertt.php
46 lines (36 loc) · 1.19 KB
/
insertt.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
include('assets/server/connection.php');
if(isset($_POST['submit'])){
$name=$_POST['name'];
$email=$_POST['email'];
$number=$_POST['number'];
$password=$_POST['password'];
$confirm_password = $_POST['confirm_password'];
if($_POST['password'] != $_POST['confirm_password']){
echo"
<script>
alert('passwords are not matiching');
window.location.href='register.html';
</script>";
}
else{
$dup_no = mysqli_query($conn,"SELECT * FROM `users` WHERE num = '$number'");
$dup_email = mysqli_query($conn,"SELECT * FROM `users` WHERE user_email= '$email'");
if(mysqli_num_rows($dup_email)||mysqli_num_rows($dup_no)){
echo"
<script>
alert('This email is already registered');
window.location.href='register.html';
</script>";
}
else{
mysqli_query($conn,"INSERT INTO `users` (`user_name`, `user_email`, `num`, `user_password`) VALUES ( '$name', '$email', '$number', '$password')");
echo " <script>
alert(' registered successfully');
window.location.href='login.html';
</script>";
}
}
}
?>
?>