I'm going to post the code in the files used with this page that is used to send a password and username reminder.
REMINDER PAGE:
<?php
session_start();
//CODE 01 is used to send a password reminder
if(!isset($code) || $code == '')
{
header('Location: index.php');
}
elseif($code == 'fpass')
{
echo $forgot['password'] . 'test';
include('forms/forgot_pass.php');
exit();
}
//CODE 01 is used to send a username AND password reminder
elseif($code == 'fuser')
{
echo $forgot['username'] . 'test';
include('forms/forgot_user.php');
exit();
}
elseif($_POST['submit'] == 'Send Password')
{
$sql = "SELECT password FROM users WHERE email = '" . $_POST['email'] . "'";
$query = mysql_query($sql) or die(sql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) == 1)
{
mail($_POST['email'], $forgot['subject1'], $forgot['message1'], $forgot['headers']);
echo $forgot['pass_sent'];
exit();
}
else
{
echo $forgot['email'];
include('forms/forgot_user.php');
exit();
}
}
elseif($_POST['submit'] == 'Send Username')
{
$sql = "SELECT username, password FROM users WHERE email = '" . $_POST['email'] . "'";
$query = mysql_query($sql) or die(sql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) == 1)
{
mail($_POST['email'], $forgot['subject2'], $forgot['message2'], $forgot['headers']);
echo $forgot['user_sent'];
exit();
}
else
{
echo $forgot['email'];
include('forms/forgot_user.php');
exit();
}
}
?>
FORGOT_PASS.PHP:
<form name="forgot_pass" method="post" action="<?php $SERVER['PHP_SELF']; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Email:</td>
<td><input name="email" type="text" size="25" value="<?php echo $POST['email']; ?>"></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" value="Send Password"></td>
</tr>
</table>
</form>
FORGOT_USER.PHP"
<form name="forgot_user" method="post" action="<?php $SERVER['PHP_SELF']; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Email:</td>
<td><input name="email" type="text" size="25" value="<?php echo $POST['email']; ?>"></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" value="Send Username"></td>
</tr>
</table>
</form>
What this code is supposed to do is send a username or password reminder to ther user. What happens is, say I put in reminder.php?code=01 (reminder.php is the page, and code=01 is used to bring up the form to send pass reminder), I'll put my email address in and hit submit, and it will just show me the form again and do nothing. I even put in a WRONG email and it still just reloads to the form... WHY!