File: /home/panama/public_html_old/managesite/forgotpassword.php
<?
include("../include/config.php");
if(strlen(trim($_POST['Submit'])) > 0)
{
$forgotdb = new database();
$forgotdb->where("email='".$functions->anti_injection($_POST['email'])."'");
$forgotdb->selectstmt("admin_users");
if($forgotdb->row_count > 0)
{
$subject = SITE_NAME." Login Password";
$file_path = "../mail/forgotpassword.html";
$message = file_get_contents($file_path);
$message = str_replace("[[subject]]", $subject , $message);
$message = str_replace("[[to_name]]", ucfirst($forgotdb->f_firstname ." ".$forgotdb->f_lastname) , $message);
$message = str_replace("[[username]]", base64_decode($forgotdb->f_username) , $message);
$message = str_replace("[[password]]", base64_decode($forgotdb->f_password) , $message);
$message = str_replace("[[siteurl]]",SITE_URL, $message);
$message = str_replace("[[sitename]]",SITE_NAME, $message);
$newLine="\r\n";
//construct headers
$headers = "MIME-Version: 1.0" . $newLine;
$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .= "To: ".$_POST['email'] ."<".$_POST['email'].">" . $newLine;
$headers .= "From: ".SITE_NAME ."<".MAIL_FROM.">" . $newLine;
@mail( trim($_POST['email']) , $subject, $message, $headers);
$err_type = "success";
$err_msg = "Your account details have been sent to ".trim($_POST['email']);
}
else
{
$err_type = "error";
$err_msg = "Email address not found";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?=SITE_ADMIN_TITLE?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="<?=META_DESCRIPTION?>" />
<meta name="keywords" content="<?=META_KEYWORD?>" />
<link href="css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/style.css" />
<script type="text/javascript" src="js/lib/prototype.js"></script>
<script type="text/javascript" src="js/src/effects.js"></script>
<script type="text/javascript" src="js/validation.js"></script>
<style>
body{
background: #ffffff url(images/html.jpg) repeat-x;
}
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="30px;"><a title="<?=SITE_TITLE?>" href="../" class="backtosite">← Back to Embassy Website</a></td>
</tr>
<tr><td height="120"> </td>
</tr>
<tr>
<td align="center">
<form method="post" action="forgotpassword.php" enctype="multipart/form-data">
<table width="50%" border="0" cellpadding="0" cellspacing="1" style="border: #000099 solid 1px;">
<tr>
<td colspan="3" align="center" style="background-color:#C50500"><!--<img src="images/logo.jpg" width="262" height="113" />-->
<img src="images/logo.png" width="406" height="106" /></td>
</tr>
<tr>
<td colspan="3" align="center" valign="top" bgcolor="#FFFFFF" class="text"> </td>
</tr>
<tr>
<td colspan="3" align="center" valign="top" bgcolor="#FFFFFF" class="text">Type your Email address in the field below to receive your password by email!</td>
</tr>
<tr><td colspan="3" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td width="29%" align="right" bgcolor="#FFFFFF" class="login_text" style="color:#000000">Your E-mail Id : </td>
<td width="47%" align="left" bgcolor="#FFFFFF"><input name="email" type="text" id="email" size="45" class="textbox"/></td>
<td width="24%" align="left" bgcolor="#FFFFFF"><input type="submit" name="Submit" class="btn" value=" Send " /></td>
</tr>
<? if(strlen($err_msg) > 0) { ?>
<tr>
<td align="center" bgcolor="#FFFFFF" class="error"> </td>
<td colspan="2" align="left" bgcolor="#FFFFFF" class="<?=$err_type == 'error' ? 'error' : 'success';?>"><?=$err_msg?></td>
</tr>
<? } ?>
<tr><td height="15px" colspan="3" bgcolor="#FFFFFF"></td>
</tr>
<tr><td colspan="3" align="center" bgcolor="#FFFFFF"><a href="login.php" class="forget_pass" style="color:#0033FF">Log In</a></td>
</tr>
<tr>
<td colspan="3" align="center" bgcolor="#FFFFFF"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>