Location: PHPKode > projects > eqEpic > eqEpic0.7.8/forgetpwd.php
<?php 
/******************************************************************************
* forgetpwd.php                                                               *
* Forget Pass File                                                            *
* See readme.txt for additional information                                   *
*******************************************************************************
* eqEpic - The Epic Raid Manager                                              *
* Open-Source Project By Ryan Christenson                                     *
* =========================================================================== *
* Software Version:           eqEpic 0.7.8                                    *
* Software by:                The RSWR Network (http://www.rswr.net)          *
* Copyright 2006-2007 by:     Ryan Christenson (http://www.rswr.net)          *
* Support, News, Updates at:  http://forum.rswr.net/                          *
*******************************************************************************
* This program is free software; you can redistribute it and/or modify        *
* it under the terms of the GNU General Public License as published by        *
* the Free Software Foundation; either version 2 of the License, or           *
* (at your option) any later version.                                         *
*                                                                             *
* This program is distributed in the hope that it will be useful,             *
* but WITHOUT ANY WARRANTY; without even the implied warranty of              *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
* GNU General Public License for more details.                                *
*                                                                             *
* You should have received a copy of the GNU General Public License           *
* along with DownloadCounter; if not, write to the Free Software              *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   *
******************************************************************************/
session_start();
ob_start();
?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php include ("ewconfig.php") ?>
<?php include ("db.php") ?>
<?php include ("secinfo.php") ?>
<?php include ("advsecu.php") ?>
<?php include ("phpmkrfn.php") ?>
<?php
if (@$_POST["email"] <> "") {
	$bValidEmail = false;

	// Setup variables
	$sUsername = CurrentUserName();
	$sEmail = @$_POST["email"];
	$conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
	$sEmail = (!get_magic_quotes_gpc()) ? addslashes($sEmail) : $sEmail;
	$sFilter = "`email` = '" . AdjustSql($sEmail) . "'";
	$sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
	$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br />SQL: ' . $sSql);
	if (phpmkr_num_rows($rs) > 0) {
		$row = phpmkr_fetch_array($rs);
		$sPassword = $row["pass"];
		$bValidEmail = true;
	}
	phpmkr_free_result($rs);
	phpmkr_db_close($conn);
	if ($bValidEmail) {

		// Load email content
		LoadEmail("forgetpwd.txt");
		$sEmailFrom = str_replace("<!--\$From-->", "$Email_Name",$sEmailFrom); // Replace sender
		$sEmailTo = str_replace("<!--\$To-->", $sEmail,$sEmailTo); // Replace recipient
		$sEmailSubject = "eqEpic Password Request";
		$sEmailContent = str_replace("<!--\$Password-->", $sPassword,$sEmailContent); // Replace password
		$sEmailContent = str_replace("<!--user-->", $sUsername, $sEmailContent);

		// Send email
		Send_Email($sEmailFrom, $sEmailTo, $sEmailCc, $sEmailBcc, $sEmailSubject, $sEmailContent, $sEmailFormat);
		$_SESSION[ewSessionMessage] = "Your Password has been sent to your E-mail";
		ob_end_clean();
		header("Location: login.php");
		exit();
	}
} else {
	$bValidEmail = true;
}
?>
<?php include ("sources/header.php") ?>
<script type="text/javascript" src="ewp.js"></script>
<script type="text/javascript">
<!-- start JavaScript
	function  EW_checkMyForm(EW_this) {
	if  (!EW_hasValue(EW_this.email, "TEXT" )) {
	            if  (!EW_onError(EW_this, EW_this.email, "TEXT", "Please Enter a Valid Email Address!"))
	                return false;
	        }
	if  (!EW_checkemail(EW_this.email.value)) {
	            if  (!EW_onError(EW_this, EW_this.email, "TEXT", "Please Enter a Valid Email Address!"))
	                return false;
	        }
	return true;
	}

// end JavaScript -->
</script>
<?php if (!$bValidEmail) { ?>
<p align="center"><span class="phpmaker" style="color: Red;">Invalid Email</span></p>
<?php } ?>
<form action="forgetpwd.php" method="post" onsubmit="return EW_checkMyForm(this);">
<table border="0" align="center" class="table_other">
	<tr>
		<td>User Email</td>
		<td><input type="text" name="email" value="<?php echo @$sEmail; ?>" size="30" maxlength="255" class="text" /></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" name="submit" value="Send Password" class="button" /></td>
	</tr>
</table>
</form>
<br />
<?php include ("footer.php") ?>
Return current item: eqEpic