예제 #1
0
<font color="RED"><?
if ($cgi['email']) {
	$cgi['email'] = addslashes($cgi['email']);
	$q = mysql_query("SELECT userName,admin FROM UserDetails WHERE email LIKE '%$cgi[email]%' LIMIT 0,1") or die(mysql_error());
	$a = mysql_fetch_array($q, MYSQL_ASSOC);
	if ($a[admin] == 1) {
		$strErr.= "You are not allowed to change an admin's password<br />";
	}
	if ($a['userName'] and $cgi[admin] == 0) {
		$newpass = genRandomPas();
		$str = "<html><body>Your login: {$a[userName]} \n password: $newpass </body></html>";
		mysql_query("UPDATE UserDetails SET password='******' WHERE userName='******'") or die(mysql_error());
		//echo $str;
		//change this:
		$subject = rand(0, 1) ? $a['userName'] : (rand(0, 1) ? "$a[userName]'s password" : "WW2: $a[userName]");
		$email = new clsMAIL($cgi['email'], $subject, $str, "Your login: {$a[userName]} \n password: $newpass");
		$email->addheader("To", "\"$a[userName]\" <$cgi[email]>");
		if ($email->send()) {
			echo ("Message sent to $a[userName], check your email for the password :)");
		} else {
			echo "There was an error sending the email message";
		}
	} else {
		$strErr.= "There is no user with such e-mail address";
	}
}
echo $strErr;
?></font><p>
<form method="post" action="forgotpass.php">
	<table cellpadding="6" cellspacing="1" border="0">
		<tr>
예제 #2
0
파일: prefs.php 프로젝트: Naddiseo/WW2Game
$q = mysql_query("SELECT count(*) FROM UserDetails WHERE email=\"$em\"") or die(mysql_error());
$a = mysql_fetch_array($q);
if ($cgi['submit']) {
	//change e-mail
	echo "<center><font color=red>";
	if ($a[0] > 0) {
		echo "That email address is already in use";
	} elseif ($cgi['email'] != $cgi['emailtwo']) {
		echo "Emails you have entered do not match. Try to re-enter them.";
	} else {
		$pas = genRandomPas();
		updateUser($user->ID, " password='******', email=\"{$em}\", active='0' ");
		$title = rand(0, 1) ? "World War II :: Activation Email" : "Activation Password for WW2";
		$html = "<html><body>Your new activation password is: $pas</body></html>";
		$plain = "Your new activation password is: $pas";
		$email = new clsMAIL($cgi['email'], $title, $html, $plain);
		//$email->addheader("To","\"$a[userName]\" <$cgi[email]>");
		if ($email->send()) {
			echo "Your e-mail was changed and new activation password was sent to your new e-mail. You will not be able to login again untill you enter new activation password.";
		} else {
			echo "There was an error sending the email message";
		}
		echo "Your e-mail was changed and new activation password was sent to your new e-mail. You will not be able to login again untill you enter new activation password.";
		$_SESSION['isLogined'] = 0;
	}
	echo "</font></center>";
} elseif ($cgi['submit2']) {
	//change pass
	echo "<center><font color=red>";
	if ($cgi['passone'] != $cgi['passtwo']) {
		echo "Passwords you have entered do not match. Try to re-enter them.";