-
Notifications
You must be signed in to change notification settings - Fork 0
/
customerloginpanel.php
152 lines (134 loc) · 4.43 KB
/
customerloginpanel.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
<?php
include("header.php");
if(isset($_SESSION['customerid']))
{
echo "<script>window.location='customerpanel.php';</script>";
}
if(isset($_SESSION['sellerid']))
{
echo "<script>window.location='sellerpanel.php';</script>";
}
if(isset($_SESSION['workerid']))
{
echo "<script>window.location='workerpanel.php';</script>";
}
if(isset($_SESSION['adminid']))
{
echo "<script>window.location='adminpanel.php';</script>";
}
if($_SESSION['randnumber'] == $_POST['randnumber'])
{
if(isset($_POST['submit']))
{
$sql = "SELECT * FROM customer WHERE email_id='$_POST[emailid]' AND password='$_POST[password]' AND status='Active' ";
$qsql = mysqli_query($con,$sql);
if(mysqli_num_rows($qsql) == 1)
{
$rslogin = mysqli_fetch_array($qsql);
$_SESSION['customerid'] = $rslogin['customer_id'];
if(isset($_GET['pagename']))
{
echo "<script>window.location='" . $_GET['pagename'] . "?productid=" . $_GET['productid'] . "';</script>";
}
else
{
echo "<script>window.location='customerpanel.php';</script>";
}
}
else
{
echo "<script>alert('Login ID and password not valid..');</script>";
}
}
}
$randnumber = rand();
$_SESSION['randnumber'] = $randnumber;
?>
<main id="main">
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Customer Login</h2>
<ol>
<li><a href="index.php">Home</a></li>
</ol>
</div>
</div>
</section><!-- End Breadcrumbs -->
<hr>
<!-- ======= Services Section ======= -->
<section id="services" class="services section-bg">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="row">
<div class="col-md-3 d-flex align-items-stretch mt-4 mt-lg-0">
<div class="icon-box" data-aos="zoom-in" data-aos-delay="200" style="width: 100%;">
<h4>Customer Login</h4>
<img src="images/customericon.jpg" style="width: 100%;">
</div>
</div>
<div class="col-md-6 d-flex align-items-stretch">
<div class="icon-box" data-aos="zoom-in" data-aos-delay="100" style="width: 100%;text-align: left;">
<form method="post" action="" name="frmcstlogin" onSubmit="return validatecstlogin()">
<h4>Login Panel</h4>
<input type="hidden" name="randnumber" value="<?php echo $randnumber; ?>" >
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="emailid" name="emailid" aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" placeholder="Password" id="password" name="password">
</div>
<a href="customerforgotpassword.php">Forgot Password?</a>
<button type="submit" name="submit" id="submit" class="btn btn-info btn-lg btn-block" >Click here to Login</button>
</form>
</div>
</div>
<div class="col-md-3 d-flex align-items-stretch mt-4 mt-lg-0">
<div class="icon-box" data-aos="zoom-in" data-aos-delay="200" style="width: 100%;">
<h4><a href="customerReg.php">New User</a></h4>
<div class="icon"><i class="bx bx-file"></i></div>
<button type="button" class="btn btn-warning btn-lg btn-block" onclick="window.location='customerReg.php'" >Sign Up (It's Free)</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section><!-- End Services Section -->
<hr>
</main><!-- End #main -->
<?php
include("footer.php");
?>
<script type="application/javascript">
function validatecstlogin()
{
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; //Variable to validate Email ID
if(document.frmcstlogin.emailid.value == "")
{
alert("E-Mail ID should not be empty..");
document.frmcstlogin.emailid.focus();
return false;
}
else if(!document.frmcstlogin.emailid.value.match(emailExp))
{
alert("Kindly enter Valid Email ID.");
document.frmcstlogin.emailid.focus();
return false;
}
else if(document.frmcstlogin.password.value == "")
{
alert("Password should not be empty..");
document.frmcstlogin.password.focus();
return false;
}
else
{
return true;
}
}
</script>