<?php
$error = NULL;
include '../../db.php';
include '../../function.php';
if (isset($_POST['send'])) {
$email = $_POST['email'];
if (empty($email)) {
header('Location: password-reset-email.php?message=Please enter your Email');
exit();
}
$USER = checkEmail($email);
if ($USER) {
$code = GenarateCode($email);
if ($code) {
$sql = "SELECT `email`,`user_name`,`resetcode` FROM `user` WHERE `email`= '" . $email . "'";
$db = new DB();
$result = $db->readQuery($sql);
$row = mysql_fetch_assoc($result);
$username = $row['user_name'];
$email = $row['email'];
$resetcode = $row['resetcode'];
$current_url = $_SERVER['HTTP_HOST'];
date_default_timezone_set('Asia/Colombo');
$todayis = date("l, F j, Y, g:i a");
$subject = 'Password Reset : ' . $current_url;
$from = '[email protected]'; // give from email address
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$html = "<table style='border:solid 1px #F0F0F0; font-size: 15px; font-family: sans-serif; padding: 0;'>";
$html .= "<tr><th colspan='3' style='font-size: 18px; padding: 30px 25px 0 25px; color: #fff; text-align: center; background-color: #4184F3;'><h2>Sublime Holdings</h2> </th> </tr>";
$html .= "<tr><td colspan='3' style='font-size: 16px; padding: 20px 25px 10px 25px; color: #333; text-align: left; background-color: #fff;'><h3> Dashboard - Password Reset </h3> </td> </tr>";
$html .= "<tr><td colspan='3' style='font-size: 14px; padding: 5px 25px 10px 25px; color: #666; background-color: #fff; line-height: 25px;'><b>Password Reset Code: </b> " . $resetcode . "</td></tr>";
$html .= "<tr><td colspan='3' style='font-size: 14px; padding: 0 25px 10px 25px; color: #666; background-color: #fff; '><b>Username: </b> " . $username . "</td></tr>";
$html .= "<tr><td colspan='3' style='font-size: 14px; background-color: #FAFAFA; padding: 25px; color: #333; font-weight: 300; text-align: justify; '>Thank you</td></tr>";
$html .= "</table>";
if (mail($email, $subject, $html, $headers)) {
header('Location:password-reset.php?success=Please Check your Email..');
} else {
header('Location: password-reset-email.php?message=There was an error while sending email..');
}
}
exit();
} else {
header('Location: password-reset-email.php?message=There was an error with your email..');
exit();
}
// $pw = $_POST['password'] . 'galle@123';
// $enPass = md5($pw);
} else {
$error = TRUE;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sublime IT Solution Basic Admin Panel</title>
<link type="text/css" href="../css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" href="../css/font-awesome.min.css" rel="stylesheet">
<link type="text/css" href="../css/theme.css" rel="stylesheet">
<link type="text/css" href="../css/animate.css" rel="stylesheet">
</head>
<body style="background-image: url(../img/bg.jpg)">
<div class="container" id="container" >
<header>
<!-- Main comapny header -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a href="#"><img src="../../images/ecovilla.png"/></a>
</div>
</div>
</nav>
</header>
<section id="form" class="animated fadeInDown">
<div class="container">
<div id="loginbox" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel white-alpha-90" >
<div class="panel-heading">
<div class="panel-title text-center"><h2><span class="text-primary">Forget Password</span></h2></div>
</div>
<div class="panel-body" >
<div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
<?php
if (isset($_GET['message'])) {
?>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong> <?php echo $_GET['message'] ?></strong>
</div>
<?php
}
?>
<form id="loginform" action="" method="post" class="form-horizontal" role="form">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input id="login-username" type="email" class="form-control" name="email" value="" placeholder="Your email">
</div>
<div class="input-group col-xs-12 text-left login-action">
<div class="checkbox">
<label style="padding-top: 15px; margin: 0">
<input class="btn btn-success" type="submit" value="Send Email" name="send">
</label>
</div>
</div>
<div style="margin-top:10px" class="form-group">
<div class="col-sm-12 controls">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<footer>
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container text-center">
<div class="footer-content">
<a href="http://www.sublime.lk/" target="_blank"> Sublime IT Solution </a>
</div>
</div><!-- /.container-fluid -->
</nav>
</footer>
</div>
<script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
</body>
</html>
|