-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate_seller_account.php
47 lines (32 loc) · 1.28 KB
/
create_seller_account.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
47
<?php
require './conn.php';
if($_SERVER['REQUEST_METHOD'] === 'POST') {
$uName = $_POST['userName'];
$location = $_POST['location'];
$email = $_POST['email'];
$password = $_POST['password'];
$query1 = "SELECT * FROM buyer WHERE email='$email'";
$result1 = $con->query($query1);
$buyer_row_count = $result1->num_rows;
$query2 = "SELECT * FROM seller WHERE email='$email'";
$result2 = $con->query($query2);
$seller_row_count = $result2->num_rows;
if ($buyer_row_count == 1) {
echo "<script>alert('This email already use. Please try using other email.'); window.location = 'create_account.php';</script>";
} else if($seller_row_count == 1) {
echo "<script>alert('This email already use. Please try using other email.'); window.location = 'create_account.php';</script>";
}else {
$query3 = "INSERT INTO seller VALUES ('', '{$uName}', '{$location}', '{$email}', '{$password}')";
$result3 = $con->query($query3);
if ($result3) {
echo "<script>alert('Your seller account created Now you can login email and password'); window.location = 'login.php';</script>";
} else {
echo "<script>alert('Your account not created please try again'); window.location = 'create_account.php';</script>";
}
}
}
else {
echo "not work";
}
$con->close();
?>