-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.php
38 lines (32 loc) · 1 KB
/
save.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
<?php
$con=mysqli_connect('localhost:3306','root','','khetridb');
$firstname=$_POST['customer_name'];
$password = $_POST['customer_password'];
$email=$_POST['customer_email'];
$phone=$_POST['customer_phone'];
$address=$_POST['customer_address'];
$country=$_POST['customer_country'];
// $password = $_POST['customer_password'];
$sql="INSERT INTO `customers`(`customer_id`,`customer_name`,`customer_password`,`customer_email`,`customer_phone`,`customer_address`,`customer_country`) VALUES (0,'$firstname','$password','$email','$phone','$address','$country')";
$result = mysqli_query($con,$sql);
if($result)
{
if($firstname=="admin" && $password == "ad123"){
header("location:admin.php");
}
else{
header("location:mainPage.html");
}
}
else{
$que = "SELECT `customer_name` FROM `customers` WHERE customer_name='$firstname'";
$result = mysqli_query($con,$que);
if($result){
?>
<script type="text/javascript">
alert("username already taken")
</script>
<?php
}
}
?>