Sindbad~EG File Manager

Current Path : /usr/home/beeson/public_html/michaelbeeson_old/recipes/
Upload File :
Current File : /usr/home/beeson/public_html/michaelbeeson_old/recipes/ForgottenPassword.php

<?php session_start();
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Forgotten Username or Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php 
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Email = $_POST['Email'];
$Email2 = $_POST['Email2'];
$Email3 = $_POST['Email3'];

function writeRed($errmsg)
	{ echo 	"<P> <em><font color=\"#FF0000\">";
      echo $errmsg;
	  echo "</font></em></P>";
	}
$Success = 0;
if(trim($Email) != "")
{  require_once('query.php');
   $sql = "SELECT Username, Password FROM People WHERE Email='$Email'";
   $q = Query($sql);
   if($q->numRows() == 1)
      { $q->fetchInto($row);
	    $Username = $row[0];
	    $Password = $row[1];
		$message = "Your username is $Username and your password is $Password.";
        mail("feedback@HelpWithMath.com", "Recipe user name and password", $message, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");      
		echo("An email message containing your username and password has been sent. It will appear in your email as being sent by feedback@HelpWithMath.com.");
		$Success = 1;
	  }
   else if($q->numRows() == 0)
       writeRed("The email address you entered is not in our database. Maybe you misspelled it?");      
   else 
       writeRed("The email address you entered is in our database more than once.  Therefore, we cannot look up your username and password.");
}
if(trim($Email2) != "")
   { require_once('query.php');
     if($Email2 != $Email3)
	     writeRed("Your two entries for your new email address are not identical.  Please try again.");
     else if(trim("LastName") == "" || trim("FirstName") == "")
	     writeRed("You must fill in your first and last names.");
     $sql = "SELECT Username, Password FROM People WHERE InitCity='$InitCity' AND LastName='$LastName' AND FirstName='$FirstName'";
	 $q = Query($sql);
	 if($q->numRows() > 0)
	    { $q->fetchInto($row);
		  $Username = $row[0];
	      $Password = $row[1];
          mail($Email2,"Recipe Username and Password", "Your username is $Username and your password is $Password.");
          echo("An email message containing your username and password has been sent.");
		  $sql = "UPDATE People SET Email=$Email2 WHERE InitCity='$InitCity' AND LastName='$LastName' AND FirstName='$FirstName'";
		  Query($sql);
		  $Success = 1;
	    }
	else  // no matching records
        { writeRed("We can't find you in our database.");      
        }
   }
if($Success == 0)
{  // first time on this page, or invalid email address
  ?>
   <P>If the email address you gave when you first posted your information is still valid, 
   we can send you an email with your username and password.
   </P>

<form name="ForgottenPassword" action="<?php echo  $_SERVER['PHP_SELF']?> " method="post" >
  <P align = "center"> Enter email address: <input type="text" name="Email"></P>
   <P align="center">
            <INPUT id="SubmitEmail" type="submit" name="SubmitEmail" value="Please mail me my username and password."></P>  
</form>
<P>  If your email address has changed, the following form will let us verify your identity, update your
email address, and send your username and password to the new address.
<form name="ForgottenPassword2" action="<?php echo  $_SERVER['PHP_SELF']?> " method="post" >
  <P align = "center"> Enter new email address: <input type="text" name="Email2"></P>
  <P align="center"> Retype new email address: <input type="text" name="Email3"></P>
  <P align="center"> Last Name: <input type="text" name="LastName"></P>
  <P align="center"> First Name: <input type="text" name="FirstName"></P>
  <P align="center">Your city <input type="text" name="InitCity"</P> 
<INPUT id="SubmitEmail" type="submit" name="SubmitEmail" value="Please mail me my username and password."></P>  
</form>

</P>
<?php
}
?>

</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists