-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer_register.php
204 lines (109 loc) · 7.31 KB
/
customer_register.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
$active='Account';
include("includes/header.php");
?>
<div id="content"><!-- #content Begin -->
<div class="container"><!-- container Begin -->
<div class="col-md-12"><!-- col-md-12 Begin -->
<ul class="breadcrumb"><!-- breadcrumb Begin -->
<li>
<a href="index.php">Home</a>
</li>
<li>
Register
</li>
</ul><!-- breadcrumb Finish -->
</div><!-- col-md-12 Finish -->
<div class="col-md-3"><!-- col-md-3 Begin -->
<?php
include("includes/sidebar.php");
?>
</div><!-- col-md-3 Finish -->
<div class="col-md-9"><!-- col-md-9 Begin -->
<div class="box"><!-- box Begin -->
<div class="box-header"><!-- box-header Begin -->
<center><!-- center Begin -->
<h2> Register a new account </h2>
</center><!-- center Finish -->
<form action="customer_register.php" method="post" enctype="multipart/form-data"><!-- form Begin -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Name</label>
<input type="text" class="form-control" name="c_name" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Email</label>
<input type="text" class="form-control" name="c_email" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Password</label>
<input type="password" class="form-control" name="c_pass" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Country</label>
<input type="text" class="form-control" name="c_country" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your City</label>
<input type="text" class="form-control" name="c_city" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Contact</label>
<input type="text" class="form-control" name="c_contact" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Address</label>
<input type="text" class="form-control" name="c_address" required>
</div><!-- form-group Finish -->
<div class="form-group"><!-- form-group Begin -->
<label>Your Profile Picture</label>
<input type="file" class="form-control form-height-custom" name="c_image">
</div><!-- form-group Finish -->
<div class="text-center"><!-- text-center Begin -->
<button type="submit" name="register" class="btn btn-primary">
<i class="fa fa-user-md"></i> Register
</button>
</div><!-- text-center Finish -->
</form><!-- form Finish -->
</div><!-- box-header Finish -->
</div><!-- box Finish -->
</div><!-- col-md-9 Finish -->
</div><!-- container Finish -->
</div><!-- #content Finish -->
<?php
include("includes/footer.php");
?>
<script src="js/jquery-331.min.js"></script>
<script src="js/bootstrap-337.min.js"></script>
</body>
</html>
<?php
if(isset($_POST['register'])){
$c_name = $_POST['c_name'];
$c_email = $_POST['c_email'];
$c_pass = $_POST['c_pass'];
$c_country = $_POST['c_country'];
$c_city = $_POST['c_city'];
$c_contact = $_POST['c_contact'];
$c_address = $_POST['c_address'];
$c_image = $_FILES['c_image']['name'];
$c_image_tmp = $_FILES['c_image']['tmp_name'];
$c_ip = getRealIpUser();
move_uploaded_file($c_image_tmp,"customer/customer_images/$c_image");
$insert_customer = "insert into customers (customer_name, customer_email, customer_pass, customer_country, customer_city, customer_contact, customer_address,customer_image, customer_ip) values ('$c_name', '$c_email', '$c_pass', '$c_country', '$c_city', '$c_contact', '$c_address', '$c_image', '$c_ip')";
$run_customer = mysqli_query($con, $insert_customer);
$sel_cart = "select * from cart where ip_add='$c_ip'";
$run_cart = mysqli_query($con, $sel_cart);
$check_cart = mysqli_num_rows($run_cart);
if($check_cart>0){
/// if register have item in cart ///
$_SESSION['customer_email']=$c_email;
echo"<script>alert('Registration Successful')</script>";
echo"<script>window.open('checkout.php', '_self')</script>";
}else{
/// if register without item in cart ///
$_SESSION['customer_email']=$c_email;
echo"<script>alert('Registerstion Successful')</script>";
echo"<script>window.open('index.php', '_self')</script>";
}
}
?>