-
Notifications
You must be signed in to change notification settings - Fork 0
/
mentor.php
199 lines (177 loc) · 12.4 KB
/
mentor.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
<?php
// Initialize the session
session_start();
// Check if the user is already logged in, if yes then redirect him to welcome page
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
header("location: mentordone.php");
exit;
}
// Include config file
require_once "config.php";
// Define variables and initialize with empty values
$username = $password = "";
$username_err = $password_err = "";
// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
// Check if username is empty
if(empty(trim($_POST["email"]))){
$username_err = "Please enter email.";
header("location: credsmentor.php");
} else{
$username = trim($_POST["email"]);
}
// Check if password is empty
if(empty(trim($_POST["password"]))){
$password_err = "Please enter your password.";
header("location: credsmentor.php");
} else{
$password = trim($_POST["password"]);
}
// Validate credentials
if(empty($username_err) && empty($password_err)){
// Prepare a select statement
$sql = "SELECT * FROM mentors WHERE email = ?";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "s", $param_username);
// Set parameters
$param_username = $username;
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Store result
mysqli_stmt_store_result($stmt);
// Check if username exists, if yes then verify password
if(mysqli_stmt_num_rows($stmt) == 1){
// Bind result variables
mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password);
$savita = password_hash("savita", PASSWORD_DEFAULT);
$mrinal = password_hash("mrinal",PASSWORD_DEFAULT);
if(mysqli_stmt_fetch($stmt)){
if(password_verify($password,$savita)||password_verify($password,$mrinal)){
// Password is correct, so start a new session
session_start();
// Store data in session variables
$_SESSION["loggedin"] = true;
$_SESSION["id"] = $id;
$_SESSION["username"]= $username;
// Redirect user to welcome page
header("location: mentordone.php");
} else{
// Display an error message if password is not valid
$password_err = "The password you entered was not valid.";
header("location: wrongpmentor.php");
}
}
} else{
// Display an error message if username doesn't exist
$username_err = "No account found with that username.";
header("location: invalidmentor.php");
}
} else{
echo "Oops! Something went wrong. Please try again later.";
}
// Close statement
mysqli_stmt_close($stmt);
}
}
// Close connection
mysqli_close($link);
}
?>
<!DOCTYPE html>
<html lang="en-US" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /><title>M&M – A SIESGST Mentor-Login Page</title>
<link rel='stylesheet' id='main-styles-css' href='css\style.css' type='text/css' media='all' />
<link rel='stylesheet' id='nectar-element-fancy-box-css' href='css\nectar.css' type='text/css' media='all' />
<link rel='stylesheet' id='skin-material-css' href='css\material.css' type='text/css' media='all' />
<link rel='stylesheet' id='dynamic-css-css' href='css\dynamic.css' type='text/css' media='all' />
<link rel='stylesheet' id='redux-google-fonts-salient_redux-css' href='https://fonts.googleapis.com/css?family=Nunito%3A900%2C400%2C700%7CMontserrat%3A500%2C300%2C700%2C900%2C400%2C400italic&subset=latin&ver=1603186463' type='text/css' media='all' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script type='text/javascript' src='js\main.js'></script>
</head>
<body class=" page page-id-909 material js-comp-ver-5.7 vc_responsive"
data-megamenu-width="full-width" data-aie="zoom-out" data-ls="magnific" data-button-style="rounded_shadow" data-bg-header="true" data-responsive="1" data-ext-responsive="true" data-header-resize="1" data-header-color="light"
>
<div id="header-outer" data-has-menu="true" data-has-buttons="no" data-using-pr-menu="false" data-mobile-fixed="1" data-ptnm="false" data-lhe="animated_underline" data-user-set-bg="#ffffff" data-format="centered-logo-between-menu" data-permanent-transparent="false" data-megamenu-rt="1" data-remove-fixed="0" data-header-resize="1" data-cart="false" data-transparency-option="1" data-box-shadow="none" data-shrink-num="20" data-full-width="false" data-condense="false" data-using-secondary="0" data-using-logo="1" data-logo-height="100" data-m-logo-height="60" data-padding="28" data-transparent-header="true" data-transparent-shadow-helper="false" data-remove-border="true" class="transparent">
<header id="top">
<div class="container">
<div class="row">
<div class="col span_3">
<a id="logo" href="index.php">
<img class="stnd default-logo" alt="M&M - A SIESGST Mentor-Mentee Platform" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BSFT7BVf--/c_fill,f_auto,fl_progressive,h_320,q_auto,w_320/https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/3014/270dfa0b-dec7-4890-9fab-caba28bebcc5.PNG" /><img class="starting-logo default-logo" alt="M&M - A SIESGST Mentor-Mentee Platform" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BSFT7BVf--/c_fill,f_auto,fl_progressive,h_320,q_auto,w_320/https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/3014/270dfa0b-dec7-4890-9fab-caba28bebcc5.PNG" /><img class="starting-logo dark-version default-logo" alt="M&M - A SIESGST Mentor-Mentee Platform" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BSFT7BVf--/c_fill,f_auto,fl_progressive,h_320,q_auto,w_320/https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/3014/270dfa0b-dec7-4890-9fab-caba28bebcc5.PNG" />
</a>
</div><!--/span_3-->
<div class="col span_9 col_last">
<div class="slide-out-widget-area-toggle mobile-icon slide-out-from-right" data-icon-animation="simple-transform">
<div> <a href="#sidewidgetarea" class="closed"> <span> <i class="lines-button x2"> <i class="lines"></i> </i> </span> </a> </div>
</div>
<nav>
<ul class="sf-menu">
<li id="menu-item-5923" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-5923"><a href="mentee.php">Mentee SignUp</a></li>
<li id="menu-item-5922" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-5922"><a href="mentor.php"> Mentor SignUp</a></li>
</ul>
<ul class="buttons sf-menu" data-user-set-ocm="off"></ul>
</nav>
<div class="logo-spacing" data-using-image="true"><img class="hidden-logo" alt="M&M - SIESGST Mentor-Mentee Platform" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BSFT7BVf--/c_fill,f_auto,fl_progressive,h_320,q_auto,w_320/https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/3014/270dfa0b-dec7-4890-9fab-caba28bebcc5.PNG" /></div>
</div><!--/span_9-->
</div><!--/row-->
</div><!--/container-->
</div>
</header>
</div>
<div id="ajax-content-wrap">
<div class="container-wrap">
<div class="container main-content">
<div class="row">
<div id="fws_5fc495680dda3" data-midnight="light" data-top-percent="20%" data-bottom-percent="18%" data-bg-mobile-hidden="" class="wpb_row vc_row-fluid vc_row top-level full-width-section standard_section " style="padding-top: calc(100vw * 0.20); padding-bottom: calc(100vw * 0.18); "><div class="row-bg-wrap" data-bg-animation="none"><div class="inner-wrap"><div class="row-bg" style=""></div></div><div class="row-bg-overlay" ></div></div><ul class="nectar-parallax-scene" data-scene-position="center" data-scene-strength="19"><li class="layer" data-depth="0.00"></li><li class="layer" data-depth="0.10"><div style="background-image:url('images/b.png');"></div></li><li class="layer" data-depth="0.28"><div style="background-image:url('images/m2-1-2.png');"></div></li><li class="layer" data-depth="0.20"><div style="background-image:url('images/m1.png');"></div></li><li class="layer" data-depth="0.20"><div style="background-image:url('images/m3.png');"></div></li><li class="layer" data-depth="0.25"><div style="background-image:url('images/c.png');"></div></li></ul><div class="nectar-shape-divider-wrap no-color " style=" height:150px;" data-front="" data-style="mountains" data-position="bottom" ><svg class="nectar-shape-divider" fill="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 300" preserveAspectRatio="none">
<path d="M 1014 264 v 122 h -808 l -172 -86 s 310.42 -22.84 402 -79 c 106 -65 154 -61 268 -12 c 107 46 195.11 5.94 275 137 z"></path> <path d="M -302 55 s 235.27 208.25 352 159 c 128 -54 233 -98 303 -73 c 92.68 33.1 181.28 115.19 235 108 c 104.9 -14 176.52 -173.06 267 -118 c 85.61 52.09 145 123 145 123 v 74 l -1306 10 z"></path>
<path d="M -286 255 s 214 -103 338 -129 s 203 29 384 101 c 145.57 57.91 178.7 50.79 272 0 c 79 -43 301 -224 385 -63 c 53 101.63 -62 129 -62 129 l -107 84 l -1212 12 z"></path>
<path d="M -24 69 s 299.68 301.66 413 245 c 8 -4 233 2 284 42 c 17.47 13.7 172 -132 217 -174 c 54.8 -51.15 128 -90 188 -39 c 76.12 64.7 118 99 118 99 l -12 132 l -1212 12 z"></path>
<path d="M -12 201 s 70 83 194 57 s 160.29 -36.77 274 6 c 109 41 184.82 24.36 265 -15 c 55 -27 116.5 -57.69 214 4 c 49 31 95 26 95 26 l -6 151 l -1036 10 z"></path> </svg></div><div class="col span_12 light left">
<div class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding" data-t-w-inherits="default" data-border-radius="none" data-shadow="none" data-border-animation="" data-border-animation-delay="" data-border-width="none" data-border-style="solid" data-border-color="" data-bg-cover="" data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-hover-bg="" data-hover-bg-opacity="1" data-animation="" data-delay="0" ><div class="column-bg-overlay"></div>
<div class="vc_column-inner">
<div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element " >
<div class="wpb_wrapper">
<h1>#M&M</h1>
<h5>SIESGST Mentor-Login Page</h5>
</div>
</div>
<a class="nectar-button large see-through-2 has-icon" style="" href="#login" data-color-override="false" data-hover-color-override="false" data-hover-text-color-override="#ffffff"><span>LogIn</span><i style="font-size:28px" class="fa"></i></a>
</div>
</div>
</div>
</div>
</div>
<br><br>
<div class="container" id="login" >
<h2> Mentor Login Form</h2>
<br>
<form method="post" action="mentor.php">
<div class="form-group">
<div class="col-xs-3">
<label for="email">Email ID: </label>
<br>
<input name="email" id="email" style="width:350px;"class="form-control" type="email"/>
</div>
</div>
<br>
<div class="form-group">
<label for="password">Password: </label>
<br>
<input name="password" id="password" style="width:350px;" class="form-control" type="password"/>
</div>
<br>
<input type="submit" name="" value="login" id="btn" class="btn btn-primary">
</form>
</div>
<br><br>
<script type='text/javascript' src='js\nectar.js'></script>
<script type='text/javascript' src='js\slider.js'></script>
<script type='text/javascript' src='js\init.js'></script>
<script type='text/javascript' src='js\composer.js'></script>
</div><!--/ocm-effect-wrap-->
</body>
</html>