File Manager

Path: /home/heznutpr/log.heznutprivate.com/dashboard/

Viewing File: reset_password.php

<?php
include('../include/dbconfig.php');
if(isset($_POST["email"]) && (!empty($_POST["email"]))){
$email = $_POST["email"];
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$email = filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email) {
  	$error .="<p>Invalid email address please type a valid email address!</p>";
	}else{
	$sel_query = "SELECT * FROM `account` WHERE email='".$email."'";
	$results = mysqli_query($connection,$sel_query);
	$row = mysqli_num_rows($results);
	if ($row==""){
		$error .="<p>Invalid email address please type a valid email address!</p>";
		}
	}
	if($error!=""){
	echo "<div class='error'>".$error."</div>
	<br /><a href='javascript:history.go(-1)'>Go Back</a>";
		}else{
	$expFormat = mktime(date("H"), date("i"), date("s"), date("m")  , date("d")+1, date("Y"));
	$expDate = date("Y-m-d H:i:s",$expFormat);
	$key = md5(2418*2+$email);
	$addKey = substr(md5(uniqid(rand(),1)),3,10);
	$key = $key . $addKey;
// Insert Temp Table
mysqli_query($connection,
"INSERT INTO `password_reset_temp` (`email`, `key`, `expDate`)
VALUES ('".$email."', '".$key."', '".$expDate."');");

$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;'>Hi $fname,</p>
<center>
     <p style='font-size:18px;font-weight:normal;color:green;'>Please click on the following link to reset your password <br>
        </p>
             <br>
              
             <a href='$site_url/dashboard/new_password.php?key=$key&email=$email&action=reset' style='background-color: red;
                            padding: 12px;
                            padding-left: 100px;padding-right: 100px;
                            color: white;
                            border-radius: 12px;' target='_blank'>Reset Password</a>                       
                       
                     <br><br><br>
              <p>Please be sure to copy the entire link into your browser.
The link will expire after 1 day for security reason.</p>
<p>If you did not request this forgotten password email, no action 
is needed, your password will not be reset. However, you may want to log into 
your account and change your security password as someone may have guessed it.</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 line 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 &copy; $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 Recovery - $site_title";

$email_to = $email;
$fromserver = "info@hightowerwealthm.co.uk"; 
require("../email/PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
/*$mail->IsSMTP();*/
$mail->Host = "mail.hightowerwealthm.co.uk"; // Enter your host here
$mail->SMTPAuth = true;
$mail->Username = "info@hightowerwealthm.co.uk"; // Enter your email here
$mail->Password = "r1hW9ldi9fko"; //Enter your password here
$mail->Port = 465;
$mail->IsHTML(true);
$mail->From = "info@hightowerwealthm.co.uk";
$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;
}else{
header("Location: reset_password.php?success");
	}
   }
}else{
?>

<title>Reset Password</title>
<?php include('../authheader.php')?>
                        
                        
                        
                        <?php 
							if(isset($_GET['errorpin']))
								{
									?>
									<div class='alert alert-danger'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>Invalid Email Address! Unable to Proceed.</strong> 
									</div>
									<?php
								}
						?>
						<?php 
							if(isset($_GET['success']))
								{
									?>
									<div class='alert alert-success'>
										<button class='close' data-dismiss='alert'>&times;</button>
										<strong>An email has been sent to you with instructions on how to reset your password.</strong> 
									</div>
									<?php
								}
						?>
                         <?php if (isset($msg)) echo $msg; ?>
                        
                        <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 Email to reset your password.</p>
                                        </div>
                                    </div>
                                </div>
                                
<form method="post" action="" name="reset">
     <div class="form-group">
                                        <div class="form-label-group">
                                            <label class="form-label" for="default-01">Enter Your Email Address</label>
                                        </div>
                                        <input type="email" name="email" placeholder="username@email.com" class="form-control form-control-lg"  required>
                                    </div>
    <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>
</div>
                        </div>
                    </div>
                </div>
                <!-- wrap @e -->
            </div>
            <!-- content @e -->
        </div>
        <!-- main @e -->
    </div>
    <!-- app-root @e -->
    <!-- JavaScript -->
<?php include('../authfooter.php')?>
<?php } ?>