I have a password retrieval script like so :
<?
require("config.php"); ///// Configuration
##### Handle Registration Data
if (isset($_POST['submit']))
{
$message=NULL; // Empty variable
///// Check for Email
if (empty($_POST['xEmail']))
{
$xEmail=FALSE;
$message .='You forgot to enter your email address.<br>';
} else {
$xEmail=$_POST['xEmail'];
}
} else {
$xEmail=null;
}
##x
##### Insert Registration Data into DB, if everything checks out
if ($xEmail) {
$query="SELECT * FROM site_members WHERE mem_email='$xEmail'";
$result=@mysql_query($query);
if (mysql_num_rows($result)==1)
{
///// Make the query
$query="SELECT mem_username, mem_password, mem_firstname, mem_lastname FROM site_members WHERE mem_email='$xEmail'";
$result=@mysql_query($query); ///// Run the query
if ($row = mysql_fetch_array($result, MYSQL_NUM)) ///// If the query ran OKAY
{
///// Setup Email
$e_to=$row[2]." ".$row[3]." <".$xEmail.">";// recipients
$e_subject="Login Details / Password Retrieval";// subject
// message
$e_message='
<html>
<head>
<title>'.$e_subject.'</title>
</head>
<body>
<table>
<tr>
<td>Username :</td><td>'.$row[0].'</td>
</tr>
<tr>
<td>Password</td><td>'.$row[1].'</td>
</tr>
</table>
<br>
- Sports Pool HQ<br>
<a href="http://www.sportspoolhq.com" target="_blank">[url]http://www.sportspoolhq.com[/url]</a>
</body>
</html>
';
// HTML mail Content-type header
$e_headers = "MIME-Version: 1.0\r\n";
$e_headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
// additional headers
$e_headers .= "From: Sports Pool HQ <info@sportspoolhq.com>\r\n";
if (mail($e_to, $e_subject, $e_message, $e_headers)) {
///// Set redirect
$message.="Your details have been successfully retrieved and sent to your email.";
header("Location: [url]http://[/url]" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?message=".$message);
}else{ ///// If the query had errors
$message.='Email could not be sent due to a system error.<br>';
$message.='We apologize for any inconvenience.<br>';
$message.=mysql_error();
}
} else { ///// If the query had errors
$message.='Login details could not be retrieved due to a system error.<br>';
$message.='We apologize for any inconvenience.<br>';
$message.=mysql_error();
}
} else {
$message .='That email is not registered. If this is an error, please contact an administrator.<br>';
}
}
##x
$_site_Page="Login Details / Password Retrieval "; ///// Title
require(INC_DIR.INC_PREFIX."header.php"); ///// Header including top navigation
##### Body
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="22" id="innertopleft"> </td>
<td height="22" id="innertopmid" align="center"><font color="<?=color_switch(5);?>"><b id="lgtext">Forgotten Password Retrieval</b></font></td>
<td width="10" height="22" id="innertopright"> </td>
</tr>
<tr>
<td width="10" id="innermidleft"> </td>
<td id="innermidmid">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<tr>
<td colspan="2">Please enter you email address, to have your login details sent to you.</td>
</tr>
<tr>
<td>Email Address :</td>
<td><div align="right"><input type="text" name="xEmail" size="35" maxlength="50" value="<?if (isset($_POST['xEmail'])) echo $_POST['xEmail']; ?>" id="input"/></div></td>
</tr>
</table>
<hr width="100%" size="1" id="mainhr">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td colspan="2"><div align="right"><input type="submit" name="submit" value="Retrieve Login Details » »" id="inputb"/></div></td>
</tr>
</form>
</table>
<br>
</td>
<td width="10" id="innermidright"> </td>
</tr>
<tr>
<td width="10" height="22" id="innerbotleft"> </td>
<td height="22" id="innerbotmid"> </td>
<td width="10" height="22" id="innerbotright"> </td>
</tr>
</table>
<?
require(INC_DIR.INC_PREFIX."footer.php"); ///// Footer including bottom navigation
?>
When I try and submit the form it tries to go to "http://cpanel_forgotpassword.php/" which is not the correct address . . . can anyone see any problems in my coding above ?
Thanks in advance