-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_signup.php
107 lines (86 loc) · 3.12 KB
/
get_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
ob_start();
session_start();
// if(!isset($_POST['username']))
// {
// header('location:login.php');
// }
// if(!isset($_POST['pass']))
// {
// header('location:login.php');
// }
// if(!isset($_POST['role']))
// {
// header('location:login.php');
// }
$role = $_POST['role'];
// connectinon of db
include_once('db_connect.php');
if($role == "Buyer")
{
$user=$_POST['username'];
$name = $_POST['name'];
$pass=$_POST['pwd'];
$str_pass=password_hash($pass,PASSWORD_BCRYPT);
$email=$_POST['email'];
$contact=$_POST['contact'];
$gender = $_POST['gender'];
$proffesion = $_POST['proffesion'];
$query="SELECT * FROM `buyer` WHERE username= '$user'";
$result= mysqli_query($con,$query);
$num = mysqli_num_rows($result);
if($num>=1)
{
echo "<script>alert('username already exist, try other.')</script>";
echo "<script>window.open('signup.php','_self') </script>";
}
else
{
$insert = "INSERT INTO `buyer`(`username`, `pass`, `name`, `email`, `contact no`, `gender`, `profession`)
VALUES ('$user','$str_pass','$name','$email','$contact','$gender','$proffesion')";
$queryfire_insert=mysqli_query($con,$insert);
echo "<script>alert('successfully registered now login')</script>";
echo "<script>window.open('login.php','_blank')</script>";
// else
// {
// echo "<script>alert('technical issue visit after some time')</script>";
// echo "<script>window.open('signup.php','_self')</script>";
// }
}
}
else if($role =="Seller")
{
$user=$_POST['username'];
$name = $_POST['name'];
$pass=$_POST['pwd'];
$str_pass=password_hash($pass,PASSWORD_BCRYPT);
$email=$_POST['email'];
$contact=$_POST['contact'];
$gender = $_POST['gender'];
$proffesion = $_POST['proffesion'];
$query="SELECT * FROM `seller` WHERE username= '$user'";
$result= mysqli_query($con,$query);
$num = mysqli_num_rows($result);
if($num>=1){
echo "<script>alert('username already exist, try other.') </script>";
echo "<script>window.open('signup.php','_self') </script>";
}
else
{
$insert = "INSERT INTO `seller`(`username`, `pass`, `name`, `gender`, `email`, `contact no`, `profession`)
VALUES ('$user','$str_pass','$name','$gender','$email','$contact','$proffesion')";
if($queryfire_insert=mysqli_query($con,$insert)){
$payment = "INSERT INTO `seller_account`(`username`, `lifetime_earning`, `lifetime_withdraw`, `lifetime_large_sell`, `lifetime_medium_sell`, `lifetime_small_sell`, `lifetime_web_sell`)
VALUES ('$user','0','0','0','0','0','0')";
$queryfire_payment = mysqli_query($con, $payment);
echo "<script>alert('successfully registered now login')</script>";
echo "<script>window.open('login.php','_blank')</script>";
}
else
{
echo "<script>alert('technical issue visit after some time')</script>";
echo "<script>window.open('signup.php','_self')</script>";
}
}
}
?>