Location: PHPKode > scripts > Hot or Not Clone > hotornot/password.php
<? 
include ("config.php");

include ("header2.php");
  
  define('TABLE_NAME', 'members');   	//	table name with users info
  define('FIELD_USERNAME', 'username');	//	field name with username info
  define('FIELD_PASSWORD', 'password');	//	field name with password info
  define('FIELD_EMAIL', 'email');	//	field name with email info


	define('USE_SMTP', 'False');			//	set false if use sendmail
								//	set True if use eternal smtp server
	if (USE_SMTP == 'True') {
		ini_set("SMTP", "smtp.mycompany.com");		// smtp server
		ini_set("sendmail_from", "hide@address.com");  // email sender
	}

// uncomment next line if get error
//	ini_set("sendmail_from", "hide@address.com");  // email sender
	 
	
	
  if (isset($_POST['action']) && $_POST['action'] == "retrieve" &&
  		isset($_POST['email']) && $_POST['email'] != "") {

  	$email = $_POST['email'];
		$email = strtolower($email); 

// check an email address is possibly valid 
		if(ereg("^([^[:space:]]+)@(.+)\.(ad|ae|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|fx|ga|gb|gov|gd|ge|gf|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nato|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$", $email)){ 
			send_info($email);
	 	} else {
	 		echo '<BR><BR><BR><center><font size=2 face=Tahoma, Verdana, Arial, Helvetica, sans-serif>Enter valid email address!</center>';
			print_form();
  	}
			
	 } else {
		echo '<BR><BR><BR><center><font size=2 face=Tahoma, Verdana, Arial, Helvetica, sans-serif>Enter email address!</center>';
	 	print_form();
	 }


function print_form() {
//	print form
		echo '
					<BR><table align="center" border="0">
					<form name="retr_info" action="password.php" method="POST">
					<input type="hidden" name="action" value="retrieve">
					<tr>
						<td>
							<b><font size=2 face=Tahoma, Verdana, Arial, Helvetica, sans-serif>Email: </b>
						</td>
						<td>
							<input type="text" name="email" size="30">
						</td>
						<td colspan="2" ali	>
							<input type="submit" name="submit" value="Retrieve">
						</td>
					</tr>
					</form>
					</table>
		';
}   

function send_info($email){
include ("config.php");

	$sql = "SELECT ". FIELD_USERNAME . ", " .FIELD_PASSWORD. " 
					FROM " .TABLE_NAME. " 
					WHERE " .FIELD_EMAIL. "='" . $email . "'";
	$res = mysql_query($sql);

	
	if (mysql_num_rows($res) == 0){
		echo '<center>Email ' . $email . ' not found!</center>';
	} else {
		$row = mysql_fetch_array($res);
		
		$username = $row['username'];
		$password = $row['password'];
		
		$content2 = "Your login info at $site_title \n\n" ; 
		$content2 .= "Username : " . $username . "\n" ; 
		$content2 .= "Password : " . $password . "\n" ; 
		$content2 .= "Username and Password are case sensitive.\n\n" ; 
		$content2 .= "\n" ; 
		$content2 .= "Thank you\n"; 
		$content2 .= "$site_title Support Team\n"; 

		$subject = "Your Login Details";

		$mailheaders = "From: ".$passwordemail." <".$passwordemail.">\r\n"; 
		$mailheaders .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n";
			
		if (mail($email, $subject, $content2, $mailheaders) != true){
			echo '<BR><BR><BR><center><font size=2 face=Tahoma, Verdana, Arial, Helvetica, sans-serif>Server can not send email now. Try later. Sorry.';
		} else {
			echo '<BR><BR><BR><center><font size=2 face=Tahoma, Verdana, Arial, Helvetica, sans-serif>Email sent to <b>' . $email . '<b></center>';
		}
	}
}
include ("footer.php");
?>
Return current item: Hot or Not Clone