473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need help for forgot password page

52
Hi all, i need help in this forgot password page, as the error message is show in another page cause the arrangement of the design in a mess. As i want to show the error message on the forgot password page.


[PHP]
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();  // Start Session
  3. session_register("session");
  4.  
  5. $email_address = $_POST['email_address'];
  6. if (!isset($_POST['email_address'])) {
  7. ?>
  8. <title>QUALTY MANAGEMENT SYSTEM</title>
  9. <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  10. <!-- fwtable fwsrc="layout.png" fwbase="layout.gif" fwstyle="Dreamweaver" fwdocid = "1867439519" fwnested="0" -->
  11.   <tr>
  12.    <td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
  13.    <td><img src="images/spacer.gif" width="89" height="1" border="0" alt=""></td>
  14.    <td><img src="images/spacer.gif" width="113" height="1" border="0" alt=""></td>
  15.    <td><img src="images/spacer.gif" width="124" height="1" border="0" alt=""></td>
  16.    <td><img src="images/spacer.gif" width="74" height="1" border="0" alt=""></td>
  17.    <td><img src="images/spacer.gif" width="51" height="1" border="0" alt=""></td>
  18.    <td><img src="images/spacer.gif" width="49" height="1" border="0" alt=""></td>
  19.    <td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
  20.    <td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
  21.    <td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  22.   </tr>
  23.  
  24.   <tr>
  25.    <td colspan="2"><a href="main.php"><img name="layout_r1_c1" src="images/layout_r1_c1.gif" width="189" height="80" border="0" alt=""></a></td>
  26.    <td colspan="7"><img name="layout_r1_c3" src="images/layout_r1_c3.gif" width="611" height="80" border="0" alt=""></td>
  27.    <td><img src="images/spacer.gif" width="1" height="80" border="0" alt=""></td>
  28.   </tr>
  29.   <tr>
  30.    <td colspan="9">&nbsp;</td>
  31.    <td><img src="images/spacer.gif" width="1" height="8" border="0" alt=""></td>
  32.   </tr>
  33.   <tr>
  34.     <td colspan="4">
  35.       <span class="login_name"> </span></td>
  36.    <td colspan="3"><img name="layout_r3_c5" src="images/layout_r3_c5.gif" width="174" height="50" border="0" alt=""></td>
  37.   <td rowspan="2" colspan="2"><img name="layout_r3_c8" src="images/layout_r3_c8.gif" width="200" height="70" border="0" alt=""></td>
  38.    <td><img src="images/spacer.gif" width="1" height="50" border="0" alt=""></td>
  39.   </tr>
  40.   <tr>
  41.    <td rowspan="5"><img name="layout_r4_c1" src="images/info.gif" width="84" height="81" border="0" alt=""></td>
  42.    <td rowspan="5" colspan="2"><img name="layout_r4_c2" src="images/layout_r4_c2.gif" width="202" height="90" border="0" alt=""></td>
  43.    <td rowspan="7"><img name="layout_r4_c4" src="images/layout_r4_c4.gif" width="124" height="160" border="0" alt=""></td>
  44.    <td rowspan="3"><img name="layout_r4_c5" src="images/layout_r4_c5.gif" width="74" height="60" border="0" alt=""></td>
  45.    <td colspan="2"><img name="layout_r4_c6" src="images/layout_r4_c6.gif" width="100" height="20" border="0" alt=""></td>
  46.    <td><img src="images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  47.   </tr>
  48.   <tr>
  49.    <td rowspan="4" colspan="2"><img name="layout_r5_c6" src="images/layout_r5_c6.gif" width="100" height="70" border="0" alt=""></td>
  50.    <td><img name="layout_r5_c8" src="images/layout_r5_c8.gif" width="100" height="20" border="0" alt=""></td>
  51.    <td><img name="layout_r5_c9" src="images/layout_r5_c9.gif" width="100" height="20" border="0" alt=""></td>
  52.    <td><img src="images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  53.   </tr>
  54.   <tr>
  55.    <td rowspan="3"><img name="layout_r6_c8" src="images/layout_r6_c8.gif" width="100" height="50" border="0" alt=""></td>
  56.    <td rowspan="3"><img name="layout_r6_c9" src="images/layout_r6_c9.gif" width="100" height="50" border="0" alt=""></td>
  57.    <td><img src="images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  58.   </tr>
  59.   <tr>
  60.    <td><img name="layout_r7_c5" src="images/layout_r7_c5.gif" width="74" height="20" border="0" alt=""></td>
  61.    <td><img src="images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  62.   </tr>
  63.   <tr>
  64.    <td rowspan="3"><img name="layout_r8_c5" src="images/layout_r8_c5.gif" width="74" height="80" border="0" alt=""></td>
  65.    <td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td>
  66.   </tr>
  67.   <tr>
  68.     <td colspan="2" rowspan="4" valign="top">
  69.       <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  70.  
  71.       <p class="style3">
  72.         <label for="email_address">Email:</label>
  73.         <input type="text" title="Please enter your email address" name="email_address" size="20"/>
  74.       </p>
  75.       <p class="style3">
  76.         <label title="Reset Password"></label>
  77.         <input name="submit" type="submit" class="submit-button" value="Submit"/>
  78.       </p>
  79.     </form>
  80.         <?php
  81. }
  82. elseif (empty($email_address)) {
  83.     echo $empty_fields_message;
  84. }
  85. else {
  86. $email_address=mysql_real_escape_string($email_address);
  87. $status = "OK";
  88. $msg="";
  89. //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
  90. if (!stristr($email_address,"@") OR !stristr($email_address,".")) {
  91. $msg="Your email address is not correct<BR>"; 
  92. $status= "NOTOK";}
  93.  
  94. echo "<br><br>";
  95. if($status=="OK"){  
  96. $query="SELECT email_address,username FROM users WHERE users.email_address = '$email_address'";
  97. $st=mysql_query($query);
  98. $recs=mysql_num_rows($st);
  99. $row=mysql_fetch_object($st);
  100. $em=$row->email_address;// email is stored to a variable
  101.  if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database.</center>"; exit;}
  102. function makeRandomPassword() { 
  103.           $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
  104.           srand((double)microtime()*1000000);  
  105.           $i = 0; 
  106.           while ($i <= 7) { 
  107.                 $num = rand() % 33; 
  108.                 $tmp = substr($salt, $num, 1); 
  109.                 $pass = $pass . $tmp; 
  110.                 $i++; 
  111.           } 
  112.           return $pass; 
  113.     } 
  114.     $random_password = makeRandomPassword(); 
  115.     $db_password = md5($random_password); 
  116.  
  117.     $sql = mysql_query("UPDATE users SET password='$db_password'  
  118.                 WHERE email_address='$email_address'"); 
  119.  
  120.     $subject = "Your password at www.yoursite.com"; 
  121.     $message = "Hi, we have reset your password. 
  122.  
  123.     New Password: $random_password 
  124.  
  125.     Once logged in you can change your password 
  126.  
  127.     Thanks! 
  128.     Site admin 
  129.  
  130.     This is an automated response, please do not reply!"; 
  131.  
  132.     mail($email_address, $subject, $message, "From: <admin@site.com>\n 
  133.         X-Mailer: PHP/" . phpversion()); 
  134.     echo "Your password has been sent! Please check your email!<br />"; 
  135.  } 
  136.  else  {"<middle><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></middle></font>";}
  137. }
  138. ?>
  139.       <br>
  140.       <br></td>
  141.     <td rowspan="2">&nbsp;</td>
  142.    <td colspan="2"><img name="layout_r9_c6" src="images/layout_r9_c6.gif" width="100" height="20" border="0" alt=""></td>
  143.    <td rowspan="2"><img name="layout_r9_c8" src="images/layout_r9_c8.gif" width="100" height="70" border="0" alt=""></td>
  144.    <td rowspan="2"><img name="layout_r9_c9" src="images/layout_r9_c9.gif" width="100" height="70" border="0" alt=""></td>
  145.    <td><img src="images/spacer.gif" width="1" height="20" border="0" alt=""></td>
  146.   </tr>
  147.   <tr>
  148.    <td colspan="2"><img name="layout_r10_c6" src="images/layout_r10_c6.gif" width="100" height="50" border="0" alt=""></td>
  149.    <td><img src="images/spacer.gif" width="1" height="50" border="0" alt=""></td>
  150.   </tr>
  151.   <tr>
  152.    <td rowspan="2"><img name="layout_r11_c3" src="images/layout_r11_c3.gif" width="113" height="272" border="0" alt=""></td>
  153.    <td colspan="3"><p class="style1">&nbsp;</p>    </td>
  154.    <td colspan="3">&nbsp;</td>
  155.    <td><img src="images/spacer.gif" width="1" height="136" border="0" alt=""></td>
  156.   </tr>
  157.   <tr>
  158.    <td colspan="3"><img name="layout_r12_c4" src="images/layout_r12_c4.gif" width="249" height="136" border="0" alt=""></td>
  159.    <td colspan="3"><img name="layout_r12_c7" src="images/layout_r12_c7.gif" width="249" height="136" border="0" alt=""></td>
  160.    <td><img src="images/spacer.gif" width="1" height="136" border="0" alt=""></td>
  161.   </tr>
  162.   <tr>
  163.    <td colspan="9"><img name="layout_r13_c1" src="images/layout_r13_c1.gif" width="800" height="30" border="0" alt=""></td>
  164.    <td><img src="images/spacer.gif" width="1" height="30" border="0" alt=""></td>
  165.   </tr>
  166. </table>
  167.  
[/PHP]
Jul 11 '07 #1
2 1966
pbmods
5,821 Expert 4TB
Heya, chaos.

What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Jul 11 '07 #2
chaos
52
Heya, chaos.

What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.

My echo message tend to show out on other page instead of appearing at the forgot password page.
What can i do in order to show the echo message in hidden message??
Example : echo "Your password has been sent! Please check your email!
$msg="Your email address is not correct
Jul 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: DDK | last post by:
I really wish there were some examples explaining how to create a forgot password email link system when you encrypt a password in a database and use ASP.NET/C# preferably. Since the password is...
15
by: carr4895 | last post by:
Hello. I was wondering if someone could help me too with a login form. Upon startup, I have to display a password screen and it should accept a user name and password. User name can be anything...
5
by: barry | last post by:
Below are my setting in the web.config file for forgotten passwords. I receive a completion that the password has been sent but upon looking in outlook there is no email sent to me. I have also...
3
by: bb nicole | last post by:
I have did the company login and job post which means that company can post the job after they login in my webpage.. I had set company_ID(tablename:company) is foreign key of table job. But when i...
2
by: whitey | last post by:
Can anybody supply me with a script the does what is in the title above please? I have tried so many different methods! here is what im currently trying to get to work SIGN IN <!doctype...
6
by: lightyagami | last post by:
how to code the "forgot your password?" in php??? i have a login account where i want to display also the "forgot your password?" but i dont know how to code it in PHP...can u help me?
3
by: jerrydigital | last post by:
Hi, I am working on a forgotpassword.asp page. I would like the user to enter their email address, and click submit. Upon submit, an email will be sent to the user's email address provided with...
10
matheussousuke
by: matheussousuke | last post by:
Hi, guys, I'm developing a script and it's almost done, just left two little things: Forgot password option Change password option About forgot password: The user can use as many user names...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.