\n "; $output .= "If you have lost your password, type the email address ". "you log in with and click \"Retrieve Password\". "; // This form will re-call the login page $this_script = $_SERVER['PHP_SELF']; $output .= "
"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "
Email Address:
Password:
\n"; $output .= "
\n"; $output .= "
\n"; showpage ("Log in", $output); } //////////////////////////////////////////////////////////////////////////////// // // function userLogin // // //////////////////////////////////////////////////////////////////////////////// function userLogin($PriEmail, $Password) { //Logs the user out to prevent any dodgy business. logout_user(); // use addslashes() to prevent any nasty surprises or dodgy things. $PriEmail = addslashes($PriEmail); $Password = addslashes($Password); // $LastLoginIP and $LastLoginTime are Call By reference values // they will be updated to become the last login time. $LoginOK = login_user( $PriEmail, // in $Password, // in $LastLoginIP, // output (call by reference) $LastLoginTime, // output $Pending); // output // Parse the timestamp so it's legible $LastLoginTime = parseTimeStamp($LastLoginTime); // Retrieve the StudentID - it is needed in a minute $SID = getSID($PriEmail); if ($LoginOK) { if ($Pending == "Y") { // If this is the first login, treat as an account activation and // guide the user through the steps. $output .= "Welcome! I see that this is your first time using the FPA Registry!
\n"; $output .= "To proceed, you must fill in the information you want to be ". "placed in the registry.

\n" ; $output .= "You will be guided through a 3-step process of inputting your ". "personal information, contact information, ". "and you will also be asked to input a secondary email address. You ". "must complete all the steps before ". "your record will be displayed on the Registry.

\n"; $output .= "
\n"; $output .= ""; $output .= ""; $output .= "\n"; $output .= "

\n"; } else { // Formulate output $pgTitle = "Login Successful"; $output = "\n"; $output .= "Login Successful.
\n"; $output .= "Last Logged in at $LastLoginTime from ". "$LastLoginIP

\n"; $output .= "If your browser doesn't redirect you automatically, "; $output .= "click here."; } } else { $pgTitle = "Error"; $output = "Login Failed. Please press the Back button on your ". "browser and try again.

\n"; if (!$PriEmail) { $output .= "Email address must be provided.
\n";} if (!$Password) { $output .= "Password must be provided.
\n";} } showpage ($pgTitle, $output); } //////////////////////////////////////////////////////////////////////////////// // // function retrievePasswd // // //////////////////////////////////////////////////////////////////////////////// function retrievePasswd($Email) { // Find out what the SID is $SID = getSID($Email); // Get the password hint $sql = "SELECT * FROM tblAccess "; $sql .= "WHERE SID = '$SID' "; $sql .= "LIMIT 1 "; $result_set = mysql_query($sql) or die(showpage("Error", "Query failed: " . mysql_error())); if (mysql_num_rows($result_set) == 0) { // If no results found, show this. $output .= "Sorry, no record found for that email address. \n"; } else { $results = mysql_fetch_array($result_set); $output .= "Note that your password will not be recovered to your ". "old one. It will be changed to a new password, "; $output .= "and you will be informed of the new password on screen ". "(if you answer the question) "; $output .= "or via email to your primary or secondary email account.
\n"; $output .= "
\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; } else { $output .= "No Password hint stored in database for this email ". "address.\n "; } $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "\n"; $output .= "
  
Please type the answer to your secret ". "question below and click on \"Retrieve Password\"
  
Secret Question:$results[PwHint]
Answer: "; if ($results['PwHint']) { $output .= "
  

Or, if you forget the answer to ". "your question or haven't set a secret question, ". "we can email a new password to your email account.
Primary Email Address:$Email
Backup Email Address:Not shown for ". "privacy reasons.
\n"; $output .= "
\n"; } showpage ("Retrieve Lost Password", $output); } ?>