-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
167 lines (145 loc) · 6.31 KB
/
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
<?php include "includes/head.php"; ?>
<?php
/*--create session array for storing errors-start--*/
if (!isset($_SESSION['errors']) || count($_SESSION['errors']) == 0) {
$_SESSION['errors'] = array();
}
$userName = $userEmail = $userPassword = $userConfirmPassword0 = $userType = $userStatus = $userCreatedDate = '';
if(isset($_POST['registerbtn'])){
if(empty($_POST['userFullName'])){
array_push($_SESSION['errors'], 'Name is require');
}else{
$userName = mysqli_real_escape_string($con, $_POST['userFullName']);
}
if(empty($_POST['userEmail'])){
array_push($_SESSION['errors'], 'Email is require');
}else{
$userEmail = mysqli_real_escape_string($con, $_POST['userEmail']);
}
// if(empty($_POST['userPassword'])){
// array_push($_SESSION['errors'], 'Password is require');
// }else{
// $userPassword = md5($_POST['userPassword']);
// }
// if(empty($_POST['userConfirmPassword'])){
// array_push($_SESSION['errors'], 'Confirm Password is require');
// }else{
// $userConfirmPassword = md5($_POST['userPassword']);
// }
if (empty($_POST['userPassword'])) {
array_push($_SESSION['errors'],'Password is Required');
}else{
$userPassword = $_POST['userPassword'];
}
if (empty($_POST['userConfirmPassword'])) {
array_push($_SESSION['errors'],'Confirm Password is Required');
}else{
$userConfirmPassword = $_POST['userConfirmPassword'];
}
if($userPassword != $userConfirmPassword){
array_push($_SESSION['errors'],'Confirm Password are not match ');
}else{
$userPassword = md5($_POST['userPassword']);
}
if (count($_SESSION['errors']) == 0 || !isset($_SESSION['errors'])) {
$userType = 'U';
$userStatus = 'P';
$userCreatedDate = date("Y-m-d H:i:s");
$sql = "INSERT INTO `tbl_users` (`user_name`,`user_email`, `user_password`, `user_type`, `user_status`, `user_createdDate`) VALUES('$userName', '$userEmail', '$userPassword', '$userType', '$userStatus', '$userCreatedDate')";
$result = mysqli_query($con, $sql);
if($result){
$_SESSION['successMessage'] = "Thanks for registerd. Your Mebership is Pending";
header("location:register.php");
exit();
// if(mysqli_num_rows($result)>0){
// if($row = mysqli_fetch_assoc($result)){
// }
// }
}
}
}
?>
<body>
<?php include "includes/header.php"; ?>
<main class="site-main">
<!--================Hero Banner start =================-->
<!-- <section class="mb-30px">
<div class="container">
<div class="hero-banner">
<div class="hero-banner__content">
<h3>Tours & Travels</h3>
<h1>Amazing Places on earth</h1>
<h4>December 12, 2018</h4>
</div>
</div>
</div>
</section> -->
<!--================Hero Banner end =================-->
<!--================ Blog slider start =================-->
<!--================ Blog slider end =================-->
<!--================ Start Blog Post Area =================-->
<section class="blog-post-area section-margin mt-4">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-8">
<?php
if (isset($_SESSION['errors']) && count($_SESSION['errors']) > 0) {
$errors = $_SESSION['errors'];
foreach($errors as $error){
?>
<div class="alert alert-danger ">
<?php echo $error; ?>
</div>
<?php
}
unset($_SESSION['errors']);
}
?>
<?php if(isset($_SESSION['successMessage'])){
?>
<div class="alert alert-success">
<?php echo $_SESSION['successMessage']; unset($_SESSION['successMessage']); ?>
</div>
<?php
} ?>
<form action="register.php" method="post">
<div class="conteiner">
<div class="container mb-5 mt-3">
<h2>Register Now</h2>
</div>
<!-- <div class="row"> -->
<div class="col mb-3">
<input type="text" placeholder="Enter Your Full Name" name="userFullName"
class="form-control">
</div>
<div class="col mb-3">
<input type="email" placeholder="Enter Your Email Address" name="userEmail"
class="form-control">
</div>
<div class="col mb-3">
<input type="password" placeholder="Password" name="userPassword"
class="form-control">
</div>
<div class="col mb-3">
<input type="password" placeholder="Confirm Password" name="userConfirmPassword"
class="form-control">
</div>
<div class="col mb-3">
<button class="btn btn-warning mt-4" name="registerbtn" type="submit">Submit For
Review</button>
</div>
</div>
<!-- </div> -->
</form>
</div>
<!-- Start Blog Post Siddebar -->
<?php include "includes/sidebar.php"; ?>
<!-- End Blog Post Siddebar -->
</div>
</section>
<!--================ End Blog Post Area =================-->
</main>
<?php include "includes/footer.php"; ?>
<?php include "includes/jsfiles.php"; ?>
</body>
</html>