Advertisement

05.07.2008 at 08:18AM PDT, ID: 23383064
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Php Email forgot password script

Asked by eiseng in PHP and Databases, PHP Scripting Language

Tags:

I have a script that i am tyring to get to work with proper error messages and success messages.  Also I need to figure out why it won't run.  Sometimes it will update the table with the new password but then it won't recognize it when logging in.  Any thoughts.  The script is below.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
<?php   
require_once('Connections/conn_db.php');
 
// This is displayed if all the fields are not filled in
 
// Convert to simple variables  
$email = $_POST['email'];
if (!isset($_POST['email'])) {
 
}elseif (empty($email)) {    
	$error = '2';
}else {
	$email = mysql_real_escape_string($email);
	$status = "OK";
 
	//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
	if (!stristr($email,"@") OR !stristr($email,".")) {
		$error = '3'; 
		$status = "NOTOK";
	}
 
	if($status == "OK"){  
		$query = "SELECT Email, NameFirst, NameLast FROM tbl_users WHERE Email = '$email'";
		$pass = mysql_query($query, $conn_bjBurns) or die(mysql_error());
		$row = mysql_fetch_object($pass);
		$count = mysql_num_rows($pass);
		// email is stored to a variable 
		if ($count == 0) { 
			$error = '1';
		}
		
		function makeRandomPassword() {           
			$word = "abchefghjkmnpqrstuvwxyz0123456789";           
			srand((double)microtime()*1000000);            
			$i = 0;           
				while ($i <= 7) {                 
					$num = rand() % 33;                 
					$tmp = substr($word, $num, 1);                 
					$pass = $pass . $tmp;                 
					$i++;           
				}           
				return $pass;     
		}
		 
		$random_password = makeRandomPassword();     
		$db_password = md5($random_password);          
		$sql = mysql_query("UPDATE tbl_users SET Password = '$db_password' WHERE Email = '$email'");
		
		$from = "BJBurns.com <support@bjburnsteam.com>";		  
		$subject = "Your password for BJBurns.com";     
		$message = "Your Password has been changed.          
		
		New Password: $random_password          
		
		http://bjburns.copilotcreative.com/my_signin.php    
		Once logged in you can change your password          
		
		Thank you
		
		BJ Burns Team          
		
		This is an automated response, please do not reply!";
				  
		mail($email, $subject, $message, $from);
		mysql_free_result($pass);
		header("Location:my_signin.php"); 
		}  else {
		$error = '4';	
	}
}
?>
 
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="modules/flash_ff.css" rel="stylesheet" type="text/css">
<!--[if IE 7]>
<link href="modules/flash_ie.css" rel="stylesheet" type="text/css">
<![endif]-->
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<?php $flashVars="NavURL=mainNav";
if(isset($_SESSION['loggedIn'])) { $flashVars.="Out"; }
$flashVars.="&FLV=MyERA&FLVlength=30" ;?>
<style type="text/css">
<!--
.style3 {
	font-size: 24px
}
-->
</style>
<script>
function checkError(form){
	var error = '<?php echo $error; ?>';
	switch (error){
		case '1':
			document.getElementById("Error1").style.display = "";
			break;
		case '2':
			document.getElementById("Error2").style.display = "";
			break;
		case '3':
			document.getElementById("Error3").style.display = "";
			break;
		case '4':
			document.getElementById("Error4").style.display = "";
			break;
	}
}
</script>
</head>
 
<body>
 <? include('modules/flash.php'); ?>
<table border="0" cellpadding="0" cellspacing="0" id="mainTable" align="center">
    <tr>
        <td id="mainTableLeftUpperCorner">&nbsp;</td>
        <td id="mainTableBlueHorizonCell">&nbsp;</td>
        <td id="mainTableRightUpperCorner">&nbsp;</td>
    </tr>
    <tr>
    	<td id="mainTableBlueVerticalCell">&nbsp;</td>
  	    <td bgcolor="#FFFFFF">
        <div id="flashContainer"></div>
        	<table border="0" cellpadding="0" cellspacing="0" id="innerTable">
				<tr>
                    <td class="menuCell" valign="top"><? include('modules/menu.php'); ?></td>
                   	<td>
           	  			<div align="center" style="margin-top:20px; margin-left:20px; margin-right:20px;">
                        <h1>Recover a forgotten password!</h1>
                        <form method="post" action="<?=$_SERVER['PHP_SELF']?>">
                        <div id="Error1" class="errorDisplay" align="center" style="display:none; color:#FF0000">
							<strong>INCORRECT EMAIL</strong><br />
							The email address you've provided do not match our records.<br />
							<strong>Please Try Again!</strong>
						</div>
                        <div id="Error2" class="errorDisplay" align="center" style="display:none; color:#FF0000">
                            <strong>PLEASE ENTER THE REQUIRED INFORMATION</strong><br />
                            Please type your email to recieve your new password!<br />
						</div>
                        <div id="Error3" class="errorDisplay" align="center" style="display:none; color:#FF0000">
                            <strong>EMAIL ADDRESS HAS INCORRECT FORMAT</strong><br />
                            Please try again!<br />
						</div>
                        <div id="Error4" class="errorDisplay" align="center" style="display:none; color:#FF0000">
                            <strong>SENDING ERROR</strong><br />
                            Please try again!<br />
						</div>
                        <br />
                        <script>checkError();</script>
						<table>
                        	<tr>
                            	<td>Email:</td>
                            	<td><input type="text" name="email" id="email" size="30"/></td>
                            	<td><input type="submit" value="Submit" class="submit-button"/></td>
                            </tr>
                        </table>
                      </form>
                      </div>
                      <br />        
					</td>
				</tr>
			</table>
            
        <? include('modules/footer.php'); ?>
        </td>
  	    <td id="mainTableBlueVerticalCell">&nbsp;</td>
   	</tr>
	<tr>
        <td id="mainTableLeftLowerCorner">&nbsp;</td>
        <td id="mainTableBlueHorizonCell">&nbsp;</td>
    	<td id="mainTableRightLowerCorner">&nbsp;</td>
	</tr>
</table>
<? include ('modules/disclaimer.php'); ?>
</d>
</body>
</html>
<?php
mysql_free_result($RS_Listings);
 
mysql_free_result($rs_getAddMedia);
?>
[+][-]05.07.2008 at 08:33AM PDT, ID: 21517490

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 08:34AM PDT, ID: 21517496

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:03AM PDT, ID: 21517793

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:06AM PDT, ID: 21517827

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:18AM PDT, ID: 21517930

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:22AM PDT, ID: 21517970

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:25AM PDT, ID: 21518000

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:27AM PDT, ID: 21518024

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:33AM PDT, ID: 21518077

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:38AM PDT, ID: 21518115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:50AM PDT, ID: 21518226

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 09:58AM PDT, ID: 21518303

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:00AM PDT, ID: 21518317

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:02AM PDT, ID: 21518334

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:11AM PDT, ID: 21518400

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:15AM PDT, ID: 21518437

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP Scripting Language
Tags: PHP
Sign Up Now!
Solution Provided By: Xyptilon2
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.07.2008 at 10:21AM PDT, ID: 21518485

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:23AM PDT, ID: 21518498

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:26AM PDT, ID: 21518530

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:28AM PDT, ID: 21518552

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:40AM PDT, ID: 21518650

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 10:46AM PDT, ID: 21518700

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 12:31PM PDT, ID: 21519613

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628