File Manager
Viewing File: new_password.php
<?php
/*
Author: Javed Ur Rehman
Website: https://www.mrtundeblog.com
*/
?>
<title>New Password</title>
<?php include('../authheader.php')?>
<?php
if(isset($_GET['success']))
{
?>
<div class='alert alert-success'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Congratulations! Your password has been updated successfully</strong>
</div>
<?php
}
?>
<?php
if(isset($_GET['error']))
{
?>
<div class='alert alert-danger'>
<button class='close' data-dismiss='alert'>×</button>
<strong>Congratulations! Your password has been updated successfully</strong>
</div>
<?php
}
?>
<div class="card card-bordered">
<div class="card-inner card-inner-lg">
<div class="nk-block-head">
<div class="nk-block-head-content">
<h4 class="nk-block-title">Reset Password</h4>
<div class="nk-block-des">
<p>Enter your New password.</p>
</div>
</div>
</div>
<?php
require('../include/dbconfig.php');
require_once '../include/class.user.php';
if (isset($_GET["key"]) && isset($_GET["email"])
&& isset($_GET["action"]) && ($_GET["action"]=="reset")
&& !isset($_POST["action"])){
$key = $_GET["key"];
$email = $_GET["email"];
$curDate = date("Y-m-d H:i:s");
$query = mysqli_query($connection,"
SELECT * FROM `password_reset_temp` WHERE `key`='".$key."' and `email`='".$email."';");
$row = mysqli_num_rows($query);
if ($row==""){
$error .= '<h2>Invalid Link</h2>
<p>The link is invalid/expired. Either you did not copy the correct link from the email,
or you have already used the key in which case it is deactivated.</p><br>
<div class="form-group">
<a href="'.$site_url.'/dashboard/reset_password.php" class="btn btn-lg btn-primary btn-block">Request New Link</a>
</div>';
}else{
$row = mysqli_fetch_assoc($query);
$expDate = $row['expDate'];
if ($expDate >= $curDate){
?>
<br />
<form method="post" action="" name="update">
<input type="hidden" name="action" value="update" />
<div class="form-group">
<div class="form-label-group">
<label class="form-label" for="default-01">Enter New Password</label>
</div>
<input type="password" name="pass1" id="pass1" maxlength="15" required class="form-control form-control-lg">
</div>
<div class="form-group">
<div class="form-label-group">
<label class="form-label" for="default-01">Re-Enter New Password</label>
</div>
<input type="password" name="pass2" id="pass2" maxlength="15" required class="form-control form-control-lg">
</div>
<input type="hidden" name="email" value="<?php echo $email;?>"/>
<div class="form-group">
<button class="btn btn-lg btn-primary btn-block" type="submit">Reset Password</button>
<a href='./logout' class="btn btn-lg btn-primary btn-block">Go back to login</a>
</div>
</form>
<!-- <input type="hidden" name="action" value="update" />
<br /><br />
<label><strong>Enter New Password:</strong></label><br />
<input type="password" name="pass1" id="pass1" maxlength="15" required />
<br /><br />
<label><strong>Re-Enter New Password:</strong></label><br />
<input type="password" name="pass2" id="pass2" maxlength="15" required/>
<br /><br />
<input type="hidden" name="email" value="<?php echo $email;?>"/>
<input type="submit" id="reset" value="Reset Password" />-->
<?php
}else{
$error .= "<h2>Link Expired</h2>
<p>The link is expired. You are trying to use the expired link which as valid only 24 hours (1 days after request).<br /><br /></p><br>
<div class='form-group'>
<a href='./logout.php' class='btn btn-lg btn-primary btn-block'>Go back to login</a>
</div>
";
}
}
if($error!=""){
echo "<div class='error'>".$error."</div><br />";
}
} // isset email key validate end
if(isset($_POST["email"]) && isset($_POST["action"]) && ($_POST["action"]=="update")){
$error="";
$pass1 = $_POST["pass1"];
$pass2 = $_POST["pass2"];
$email = $_POST["email"];
$curDate = date("Y-m-d H:i:s");
if ($pass1!=$pass2){
$error .= "<p>Password do not match, both password should be same.<br /><br /></p>";
}
if($error!=""){
echo "<div class='error'>".$error."</div><br />";
}else{
$pass1 = ($pass1);
mysqli_query($connection,
"UPDATE `account` SET `upass`='".$pass1."' WHERE `email`='".$email."';");
$output = "
<!DOCTYPE html>
<html lang='en' xmlns='http://www.w3.org/1999/xhtml' xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='x-apple-disable-message-reformatting'>
<title></title>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
<!-- Web Font / @font-face : BEGIN -->
<!--[if mso]>
<style>
* {
font-family: 'Roboto', sans-serif !important;
}
</style>
<![endif]-->
<!--[if !mso]>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,600' rel='stylesheet' type='text/css'>
<![endif]-->
<!-- Web Font / @font-face : END -->
<!-- CSS Reset : BEGIN -->
<style>
/* What it does: Remove spaces around the email design added by some email clients. */
/* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
html,
body {
margin: 0 auto !important;
padding: 0 !important;
height: 100% !important;
width: 100% !important;
font-family: 'Roboto', sans-serif !important;
font-size: 14px;
margin-bottom: 10px;
line-height: 24px;
color:#8094ae;
font-weight: 400;
}
* {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
margin: 0;
padding: 0;
}
table,
td {
mso-table-lspace: 0pt !important;
mso-table-rspace: 0pt !important;
}
table {
border-spacing: 0 !important;
border-collapse: collapse !important;
table-layout: fixed !important;
margin: 0 auto !important;
}
table table table {
table-layout: auto;
}
a {
text-decoration: none;
}
img {
-ms-interpolation-mode:bicubic;
}
@media only screen and (max-width:480px)
{
table[class='MainContainer'], td[class='cell']
{
width: 100% !important;
height:auto !important;
}
td[class='specbundle']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
}
td[class='specbundle1']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
}
td[class='specbundle2']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
}
td[class='specbundle3']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
padding-bottom:20px !important;
}
td[class='specbundle4']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
text-align:center !important;
}
td[class='spechide']
{
display:none !important;
}
img[class='banner']
{
width: 100% !important;
height: auto !important;
}
td[class='left_pad']
{
padding-left:15px !important;
padding-right:15px !important;
}
}
@media only screen and (max-width:540px)
{
table[class='MainContainer'], td[class='cell']
{
width: 100% !important;
height:auto !important;
}
td[class='specbundle']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
}
td[class='specbundle1']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
}
td[class='specbundle2']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
}
td[class='specbundle3']
{
width:90% !important;
float:left !important;
font-size:14px !important;
line-height:18px !important;
display:block !important;
padding-left:5% !important;
padding-right:5% !important;
padding-bottom:20px !important;
}
td[class='specbundle4']
{
width: 100% !important;
float:left !important;
font-size:13px !important;
line-height:17px !important;
display:block !important;
padding-bottom:20px !important;
text-align:center !important;
}
td[class='spechide']
{
display:none !important;
}
img[class='banner']
{
width: 100% !important;
height: auto !important;
}
td[class='left_pad']
{
padding-left:15px !important;
padding-right:15px !important;
}
.font{
font-size:15px !important;
line-height:19px !important;
}
}
</style>
</head>
<body width='100%' style='margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f5f6fa;'>
<center style='width: 100%; background-color: #f5f6fa;'>
<table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#f5f6fa'>
<tr>
<td style='padding: 40px 0;'>
<table style='width:100%;max-width:620px;margin:0 auto;'>
<tbody>
<tr>
<td style='text-align: center; padding-bottom:25px'>
<a href='#'><img style='height: 40px' src='$site_url/dashboard/admin/logo/logo.png' alt='logo'></a>
<p style='font-size: 14px; color: #6576ff; padding-top: 12px;'>--***--</p>
</td>
</tr>
</tbody>
</table>
<table style='width:100%;max-width:620px;margin:0 auto;background-color:#ffffff;'>
<tbody>
<tr>
<td style='padding: 30px 30px 20px'>
<p style='margin-bottom: 10px;'>Hello,</p>
<center>
<p style='font-size:18px;font-weight:normal;color:green;'>You have successfully change your password. <br>
Now you can login to your account with the new password you set
</p>
<br>
<h3>New Login Details</h3>
<table style='border:1px solid black;padding:2px;' width='400'>
<tr>
<th style='/* text-align:left; */background-color: red;color: white;text-align-last: center;padding: 12px;'>Email</th>
<td>$email</td>
</tr>
<tr>
<th style='/* text-align:left; */background-color: red;color: white;text-align-last: center;padding: 12px;'>New Password</th>
<td>$pass1</td>
</tr>
</table>
<br><br><br>
<a href='$site_url/login.php' style='background-color: red;
padding: 12px;
padding-left: 100px;padding-right: 100px;
color: white;
border-radius: 12px;' target='_blank'>Login</a>
<br><br><br>
<p>If you did not request this forgotten password email please send us a mail.</p>
</center>
<br>
<p style='margin-bottom: 15px;'>Hope you'll enjoy the experience, we're here if you have any questions, drop us a mail at <a style='color: #6576ff; text-decoration:none;' href='mailto:$site_email'>$site_email</a> anytime. </p>
</td>
</tr>
</tbody>
</table>
<table style='width:100%;max-width:620px;margin:0 auto;'>
<tbody>
<tr>
<td style='text-align: center; padding:25px 20px 0;'>
<p style='font-size: 13px;'>Copyright © $year $site_title. All rights reserved.</p>
<ul style='margin: 10px -4px 0;padding: 0;'>
<li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-b.png' alt='brand'></a></li>
<li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-e.png' alt='brand'></a></li>
<li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-d.png' alt='brand'></a></li>
<li style='display: inline-block; list-style: none; padding: 4px;'><a style='display: inline-block; height: 30px; width:30px;border-radius: 50%; background-color: #ffffff' href='#'><img style='width: 30px' src='$site_url/images/brand-c.png' alt='brand'></a></li>
</ul>
<p style='padding-top: 15px; font-size: 12px;'>This email was sent to you as a registered user of <a style='color: #6576ff; text-decoration:none;' href='$site_url'>$site_title</a>. To update your emails preferences <a style='color: #6576ff; text-decoration:none;' href='$site_url/login.php'>click here</a>.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>
";
$body = $output;
$subject = "Password Reset Successfully - $site_title";
$email_to = $email;
$fromserver = "support@planbxpress.com";
require("../email/PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "planbxpress.com"; // Enter your host here
$mail->SMTPAuth = true;
$mail->Username = "support@planbxpress.com"; // Enter your email here
$mail->Password = "HSCiTEfbh3k7"; //Enter your password here
$mail->Port = 587;
$mail->IsHTML(true);
$mail->From = "support@planbxpress.com";
$mail->FromName = "$site_title";
$mail->Sender = $fromserver; // indicates ReturnPath header
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($email_to);
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
mysqli_query($connection,"DELETE FROM `password_reset_temp` WHERE `email`='".$email."';");
echo '<div class="error"><div class="alert alert-success">
<button class="close" data-dismiss="alert">×</button>
<strong>Congratulations! Your password has been updated successfully</strong>
</div>
<div class="form-group">
<a href="./logout.php" class="btn btn-lg btn-primary btn-block">Go back to login</a>
</div></div><br />';
}
}
?>
</div>
</div>
</div>
</div>
<!-- wrap @e -->
</div>
<!-- content @e -->
</div>
<!-- main @e -->
</div>
<!-- app-root @e -->
<!-- JavaScript -->
<?php include('../authfooter.php')?>