Can anyone see a problem with this at a glance. I think i have pushed my luck with this forum ( inc. Chris)of late but i paid a lot of money for this script and it has a few bugs. THis is what i get returned--- Fatal error: Call to undefined function: recover_pw() in /home/realt905/public_html/lost_pw.php on line 70 where line 70 is : recover_pw($_POST['email_address']); ******************************** <?php include("connect.php"); if (isset($_POST['Submit'])) { $comp_name = $_POST['comp_name']; //get comp id $sql = "SELECT id FROM comps WHERE name = '$comp_name'"; $query = mysql_query($sql); $result = mysql_fetch_array($query); $comp_id = $result['id']; recover_pw($_POST['email_address']); function recover_pw($email_address){ if(!$email_address){ ?> <p align="center"><font size="4"><strong><?php echo $comp_name;?> Lost Password</strong></font></p> <div align="center"><strong><a href="comp_site.php?name=<?php echo $comp_name;?>">Back</a> |<a href="index.php">Main Site</a></strong></div> <?php echo "<br><br>You forgot to enter your email address!<br>"; include("lost_pw_retry.php"); exit(); } // check to see if record exists $sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address' AND comp_id = $comp_id"); $sql_check_num = mysql_num_rows($sql_check); if($sql_check_num == 0){ ?> <p align="center"><font size="4"><strong><?php echo $comp_name;?> Lost Password</strong></font></p> <div align="center"><strong><a href="comp_site.php?name=<?php echo $comp_name;?>">Back</a> |<a href="index.php">Main Site</a></strong></div> <?php echo "<br><br>No records found matching your email address<br>"; include ("lost_pw_retry.php"); exit(); } // Generate password, update it and send it function makeRandomPassword() { $salt = "abchefghjkmnpqrstuvwxyz0123456789"; $pass = ""; srand((double)microtime()*1000000); $i = 0; while ($i <= 7) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_password = makeRandomPassword(); $db_password = md5($random_password); $sql = mysql_query("UPDATE users SET password='$db_password' WHERE email_address='$email_address' and comp_id = $comp_id"); $subject = "$comp_name - password reset"; $message = "Hi, we have reset your password. New Password: $random_password To Login: $address/login_user.php?name=$comp_name Thanks! Admin This is an automated response, please do not reply!"; mail($email_address, $subject, $message, "From: Admin<$fromemailaddress>\nX-Mailer: PHP/" . phpversion()); ?> <p align="center"><font size="4"><strong><?php echo $comp_name;?> Lost Password</strong></font></p> <div align="center"><strong><a href="comp_site.php?name=<?php echo $comp_name;?>">Back</a> |<a href="index.php">Main Site</a></strong></div> <?php echo "<br><br><center>Your new password has been sent. Please check your email.</center>"; } } else { $comp_name = $_GET['name']; ?> <p align="center"><font size="4"><strong><?php echo $comp_name;?> Lost Password</strong></font></p> <div align="center"><strong><a href="comp_site.php?name=<?php echo $comp_name;?>">Back</a> |<a href="index.php">Main Site</a></strong></div> <form method="post" action="lost_pw.php"> <table width="39%" border="0" cellspacing="0" cellpadding="4" align="center"> <input type="hidden" name="comp_name" value="<?php echo $comp_name;?>"> <tr> <td>Email</td> <td><input name="email_address" type="text" id="email_address" size="50"></td> </tr> <tr> <td colspan="2" align="center"> <input name="recover" type="hidden" id="recover" value="recover"> <input type="submit" name="Submit" value="Recover My Password!"></td> </tr> </table> </form> <?php } include("footer.html"); ?> ******************************** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php