-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewpass(company).php
34 lines (27 loc) · 959 Bytes
/
newpass(company).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
<?php
//To Handle Session Variables on This Page
session_start();
//Including Database Connection From db.php file to avoid rewriting in all files
require_once("db.php");
//If user Actually clicked register button
if (isset($_POST)) {
//Escape Special Characters in String
$email = mysqli_real_escape_string($conn, $_POST['email']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
//Encrypt Password
$epassword = base64_encode(strrev(md5($password)));
//sql query to check user login
$sql = "UPDATE company SET password='$epassword' WHERE email='$email' ";
$result = $conn->query($sql);
if ($result === TRUE) {
$_SESSION['forgotPassSuccess'] = true;
header("Location: login-company.php");
exit();
} else {
echo $conn->error;
}
} else {
//redirect them back to login page if they didn't click login button
header("Location: login.php");
exit();
}