jd2007 Posted July 24, 2007 Share Posted July 24, 2007 this is a system for users to retrieve their password/username... <div class=forget> <h3>Forgot Your Username ?</h3> <form method="post" action="retrieve.php"> E-mail: <input type=text name=remailu /> <input type=submit value=Retrieve /> </form> <h3>Forget Your Password ?</h3> <form method="post" action="retrieve.php"> E-mail: <input type=text name=remailp /> <input type=submit value=Retrieve /> </form> <h3>Forget Your Username and Password ?</h3> <form method="post" action="retrieve.php"> E-mail: <input type=text name=remailup /> <input type=submit value=Retrieve /> </form> </div> retrieve.php <?php if ($_POST["remailu"]) { include("connect.php"); $query="SELECT username FROM users WHERE email='$_POST[remailu]'"; $result=mysql_query($query); $row=mysql_fetch_row($result); if (!$row) { $notfound="No user with such e-mail on this database."; header("location:forgot.php?notfound=$notfound"); } else { $to=$_POST[remailu]; $subject="Username Retrieval"; $message="Your username is $row[0]."; $mail=mail($to, $subject, $message); if ($mail) { $sent="Your username was sent to your e-mail address"; header("location:forgot.php?sent=$sent"); } else { $error="There was a problem. Please try again later."; header("location:forgot.php?error=$error"); } } } else if ($_POST["remailp"]) { include("connect.php"); $query="SELECT password FROM users WHERE email='$_POST[remailp]'"; $result=mysql_query($query); $row=mysql_fetch_row($result); if (!$row) { $notfound="No user with such e-mail on this database."; header("location:forgot.php?notfound=$notfound"); } else { $to=$_POST["remailp"]; $subject="Password Retrieval"; $message="Your username is $row[0]."; $mail=mail($to,$subject,$message); if ($mail) { $s="Your password was sent to your e-mail address"; header("location:forgot.php?sent='$s'"); } else { $error="There was a problem. Please try again later."; header("location:forgot.php?error='$error'"); } } } else { include("connect.php"); $query="SELECT username, password FROM users WHERE email='$_POST[remailup]'"; $result=mysql_query($query); $row=mysql_fetch_row($result); if (!$row) { $notfound="No user with such e-mail on this database."; header("location:forgot.php?notfound=$notfound"); } else { $to=$_POST[remailup]; $subject="Username and Password Retrieval"; $message="Your username is $row[0] and $row[1]."; $mail=mail($to, $subject, $message); if ($mail) { $sent="Your username and password was sent to your e-mail address"; header("location:forgot.php?sent=$sent"); } else { $error="There was a problem. Please try again later."; header("location:forgot.php?error=$error"); } } } ?> the output is : Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\AppServ\www\Freelance Project 1\retrieve.php on line 47 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Freelance Project 1\retrieve.php:47) in C:\AppServ\www\Freelance Project 1\retrieve.php on line 56 Link to comment https://forums.phpfreaks.com/topic/61494-why-is-the-code-below-not-workingheader-problem/ Share on other sites More sharing options...
JJohnsenDK Posted July 24, 2007 Share Posted July 24, 2007 You to put in a header variable in the mail function. $headers .= "From: What ever your site is called\n";, $mail=mail($to, $subject, $message, $headers); Link to comment https://forums.phpfreaks.com/topic/61494-why-is-the-code-below-not-workingheader-problem/#findComment-306103 Share on other sites More sharing options...
jd2007 Posted July 24, 2007 Author Share Posted July 24, 2007 thanks... Link to comment https://forums.phpfreaks.com/topic/61494-why-is-the-code-below-not-workingheader-problem/#findComment-306121 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.