Link to home
Start Free TrialLog in
Avatar of Wanda Marston
Wanda MarstonFlag for Canada

asked on

Cannot figure out why I am getting an unexpected T-string error message.

I am trying to set up a "Forgot Password" page but getting the error message above.

Below is the portion of my code where this is supposedly occurring - at line 171. Line 171 is the line that says - - - - session_register("session");

  <div id="nav">
    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
   
    <?php
session_start();  // Start Session
session_register("session");
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php
}
elseif (empty($email_address)) {
    echo $empty_fields_message;
}
else {
$email_address=mysql_real_escape_string($email_address);
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Can you post the whole page code in a code block?  Often, t-string errors actually occur farther up in the code and it is only discovered when the php at the reported error line interacts with that code.
Avatar of Wanda Marston

ASKER

Don't know exactly what you mean by code block - I know I SHOULD know but anyway, I believe the following is my whole page.

<?php require_once('Connections/TBR.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_TBR, $TBR);
$query_Recordset1 = "SELECT * FROM IDTBR2010";
$Recordset1 = mysql_query($query_Recordset1, $TBR) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=md5($_POST['Password']);
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "MemberProfileTBR.php";
  $MM_redirectLoginFailed = "IndexIncorrect.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_TBR, $TBR);
  
  $LoginRS__query=sprintf("SELECT UserName, Password FROM idtbr2010 WHERE UserName=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $TBR) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Index</title>
<style type="text/css">
<!--
body {
	background-color: #FFF;
	text-align: center;
}
#wrapper {
	text-align: left;
	width: 900px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
}
#description {
	height: 150px;
	background-color: #DEA749;
	width: 894px;
	margin-left: 6px;
}
#header {
	margin-top: 12px;
	margin-bottom: 12px;
}
#footer {
	margin-top: 12px;
	margin-bottom: 12px;
	clear: both;
	padding-left: 6px;
}
#logo {
	height: 81px;
}
#slogan {
	height: 36px;
}
#content {
	height: 504px;
	margin-left: 6px;
}
#nav {
	height: 50px;
	width: 894px;
	background-color: #DEA74B;
	margin-left: 6px;
}
#secondNavBar {
	height: 40px;
	margin-left: 6px;
}
-->
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="forms.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
  <div id="header">
    <div id="logo"><img src="Images/TBRlogoHoriz.jpg" width="900" height="81" alt="logo" /></div>
  </div>
  <div id="slogan">
    <p><img src="Images/TBRsloHoriz.jpg" width="900" height="36" alt="slogan" /></p>
</div>
  <div id="description"><img src="Images/Des.jpg" width="274" height="150" alt="Description" /><img src="Images/WhatItIs.jpg" width="185" height="150" alt="WhatItIs?" /><img src="Images/WhyWeNeedIt.jpg" width="225" height="150" alt="WhyWeNeedIt?" /><img src="Images/HowItWorks.jpg" width="210" height="150" alt="HowItWorks?" /></div>
  <div id="nav">
    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
    
    <?php
session_start();  // Start Session
session_register("session");
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php
}
elseif (empty($email_address)) {
    echo $empty_fields_message;
}
else {
$email_address=mysql_real_escape_string($email_address);
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email_address,"@") OR !stristr($email_address,".")) {
$msg="Your email address is not correct<BR>"; 
$status= "NOTOK";}

echo "<br><br>";
if($status=="OK"){  $query="SELECT email_address,username FROM users WHERE users.email_address = '$email_address'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email_address;// email is stored to a variable
 if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='http://www.jackgodfrey.org.uk/register'>Register</a> </center>"; exit;}
function makeRandomPassword() { 
          $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
          srand((double)microtime()*1000000);  
          $i = 0; 
          while ($i <= 7) { 
                $num = rand() % 33; 
                $tmp = substr($salt, $num, 1); 
                $pass = $pass . $tmp; 
                $i++; 
          } 
          return $pass; 
    } 
    $random_password = makeRandomPassword(); 
    $db_password = md5($random_password); 
     
    $sql = mysql_query("UPDATE users SET password='$db_password'  
                WHERE email_address='$email_address'"); 
     
    $subject = "Your password at www.yoursite.com"; 
    $message = "Hi, we have reset your password. 
     
    New Password: $random_password 
     
    http://www.yoursite.com/login
    Once logged in you can change your password 
     
    Thanks! 
    Site admin 
     
    This is an automated response, please do not reply!"; 
     
    mail($email_address, $subject, $message, "From: yoursite.com Webmaster<admin@jyoursite.com>\n 
        X-Mailer: PHP/" . phpversion()); 
    echo "Your password has been sent! Please check your email!<br />"; 
    echo "<br><br>Click <a href='http://www.yoursite.com/login'>here</a> to login";
 } 
 else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
}
?>

    <p>&nbsp;</p>
<p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
  <div id="secondNavBar">
    <ul id="MenuBar2" class="MenuBarHorizontal">
      <li><a href="Index.php">Home</a></li>
      <li><A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A></li>
      <li><a href="TBRContactUs.html">Contact Us</a>      </li>
<li><a href="TBRAboutTBR.html">About Us</a>      </li>
      <li><a href="TBRUserAgree.html" class="MenuBarItemSubmenu">User Agreement</a>
        <ul>
          <li><a href="TBRTerms.html">Terms and Conditions</a></li>
<li><a href="TBRPrivacyPol.html">Privacy Policy</a></li>
        </ul>
      </li>
    </ul>
  </div>
</div>
</div>
</div>
  </div>
</div>
  </div>
  <div id="footer"><a href="Index.php">Home</a> | <A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A> | <a href="TBRContactUs.html">Contact Us</a> | <a href="TBRAboutTBR.html">About Us</a><a href="../TBRAboutTBR.html"></a> |<br />
  <a href="TBRUserAgree.html">User Agreement</a> | <a href="TBRTerms.html">Terms and Condiditons</a> | <a href="TBRPrivacyPol.html">Privacy Policy</a> | <a href="Register.php" title="Going to Register Page">Register</a></div>
</div>
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Open in new window

Do you see the button in the comment box that says "Code"? :)  Anyway, good enough.
Just out of curiousity, why are you even using session_register()?
Also, you have two calls to session_start().  Lines 43 and 170.  The one at 170 doesn't need to be there (and neither does session_register).  Remove those two lines and test again.
<?php require_once('Connections/TBR.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_TBR, $TBR);
$query_Recordset1 = "SELECT * FROM IDTBR2010";
$Recordset1 = mysql_query($query_Recordset1, $TBR) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=md5($_POST['Password']);
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "MemberProfileTBR.php";
  $MM_redirectLoginFailed = "IndexIncorrect.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_TBR, $TBR);
  
  $LoginRS__query=sprintf("SELECT UserName, Password FROM idtbr2010 WHERE UserName=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $TBR) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Index</title>
<style type="text/css">
<!--
body {
	background-color: #FFF;
	text-align: center;
}
#wrapper {
	text-align: left;
	width: 900px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
}
#description {
	height: 150px;
	background-color: #DEA749;
	width: 894px;
	margin-left: 6px;
}
#header {
	margin-top: 12px;
	margin-bottom: 12px;
}
#footer {
	margin-top: 12px;
	margin-bottom: 12px;
	clear: both;
	padding-left: 6px;
}
#logo {
	height: 81px;
}
#slogan {
	height: 36px;
}
#content {
	height: 504px;
	margin-left: 6px;
}
#nav {
	height: 50px;
	width: 894px;
	background-color: #DEA74B;
	margin-left: 6px;
}
#secondNavBar {
	height: 40px;
	margin-left: 6px;
}
-->
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="forms.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
  <div id="header">
    <div id="logo"><img src="Images/TBRlogoHoriz.jpg" width="900" height="81" alt="logo" /></div>
  </div>
  <div id="slogan">
    <p><img src="Images/TBRsloHoriz.jpg" width="900" height="36" alt="slogan" /></p>
</div>
  <div id="description"><img src="Images/Des.jpg" width="274" height="150" alt="Description" /><img src="Images/WhatItIs.jpg" width="185" height="150" alt="WhatItIs?" /><img src="Images/WhyWeNeedIt.jpg" width="225" height="150" alt="WhyWeNeedIt?" /><img src="Images/HowItWorks.jpg" width="210" height="150" alt="HowItWorks?" /></div>
  <div id="nav">
    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
    
    <?php
session_start();  // Start Session
session_register("session");
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php
}
elseif (empty($email_address)) {
    echo $empty_fields_message;
}
else {
$email_address=mysql_real_escape_string($email_address);
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email_address,"@") OR !stristr($email_address,".")) {
$msg="Your email address is not correct<BR>"; 
$status= "NOTOK";}

echo "<br><br>";
if($status=="OK"){  $query="SELECT email_address,username FROM users WHERE users.email_address = '$email_address'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email_address;// email is stored to a variable
 if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='http://www.jackgodfrey.org.uk/register'>Register</a> </center>"; exit;}
function makeRandomPassword() { 
          $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
          srand((double)microtime()*1000000);  
          $i = 0; 
          while ($i <= 7) { 
                $num = rand() % 33; 
                $tmp = substr($salt, $num, 1); 
                $pass = $pass . $tmp; 
                $i++; 
          } 
          return $pass; 
    } 
    $random_password = makeRandomPassword(); 
    $db_password = md5($random_password); 
     
    $sql = mysql_query("UPDATE users SET password='$db_password'  
                WHERE email_address='$email_address'"); 
     
    $subject = "Your password at www.yoursite.com"; 
    $message = "Hi, we have reset your password. 
     
    New Password: $random_password 
     
    http://www.yoursite.com/login
    Once logged in you can change your password 
     
    Thanks! 
    Site admin 
     
    This is an automated response, please do not reply!"; 
     
    mail($email_address, $subject, $message, "From: yoursite.com Webmaster<admin@jyoursite.com>\n 
        X-Mailer: PHP/" . phpversion()); 
    echo "Your password has been sent! Please check your email!<br />"; 
    echo "<br><br>Click <a href='http://www.yoursite.com/login'>here</a> to login";
 } 
 else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
}
?>

    <p>&nbsp;</p>
<p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
  <div id="secondNavBar">
    <ul id="MenuBar2" class="MenuBarHorizontal">
      <li><a href="Index.php">Home</a></li>
      <li><A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A></li>
      <li><a href="TBRContactUs.html">Contact Us</a>      </li>
<li><a href="TBRAboutTBR.html">About Us</a>      </li>
      <li><a href="TBRUserAgree.html" class="MenuBarItemSubmenu">User Agreement</a>
        <ul>
          <li><a href="TBRTerms.html">Terms and Conditions</a></li>
<li><a href="TBRPrivacyPol.html">Privacy Policy</a></li>
        </ul>
      </li>
    </ul>
  </div>
</div>
</div>
</div>
  </div>
</div>
  </div>
  <div id="footer"><a href="Index.php">Home</a> | <A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A> | <a href="TBRContactUs.html">Contact Us</a> | <a href="TBRAboutTBR.html">About Us</a><a href="../TBRAboutTBR.html"></a> |<br />
  <a href="TBRUserAgree.html">User Agreement</a> | <a href="TBRTerms.html">Terms and Condiditons</a> | <a href="TBRPrivacyPol.html">Privacy Policy</a> | <a href="Register.php" title="Going to Register Page">Register</a></div>
</div>
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Open in new window

Thanks, Actually didn't see that. Is this better?

WC

Open in new window

<?php require_once('Connections/TBR.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_TBR, $TBR);
$query_Recordset1 = "SELECT * FROM IDTBR2010";
$Recordset1 = mysql_query($query_Recordset1, $TBR) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=md5($_POST['Password']);
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "MemberProfileTBR.php";
  $MM_redirectLoginFailed = "IndexIncorrect.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_TBR, $TBR);
  
  $LoginRS__query=sprintf("SELECT UserName, Password FROM idtbr2010 WHERE UserName=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $TBR) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Index</title>
<style type="text/css">
<!--
body {
	background-color: #FFF;
	text-align: center;
}
#wrapper {
	text-align: left;
	width: 900px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
}
#description {
	height: 150px;
	background-color: #DEA749;
	width: 894px;
	margin-left: 6px;
}
#header {
	margin-top: 12px;
	margin-bottom: 12px;
}
#footer {
	margin-top: 12px;
	margin-bottom: 12px;
	clear: both;
	padding-left: 6px;
}
#logo {
	height: 81px;
}
#slogan {
	height: 36px;
}
#content {
	height: 504px;
	margin-left: 6px;
}
#nav {
	height: 50px;
	width: 894px;
	background-color: #DEA74B;
	margin-left: 6px;
}
#secondNavBar {
	height: 40px;
	margin-left: 6px;
}
-->
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="forms.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
  <div id="header">
    <div id="logo"><img src="Images/TBRlogoHoriz.jpg" width="900" height="81" alt="logo" /></div>
  </div>
  <div id="slogan">
    <p><img src="Images/TBRsloHoriz.jpg" width="900" height="36" alt="slogan" /></p>
</div>
  <div id="description"><img src="Images/Des.jpg" width="274" height="150" alt="Description" /><img src="Images/WhatItIs.jpg" width="185" height="150" alt="WhatItIs?" /><img src="Images/WhyWeNeedIt.jpg" width="225" height="150" alt="WhyWeNeedIt?" /><img src="Images/HowItWorks.jpg" width="210" height="150" alt="HowItWorks?" /></div>
  <div id="nav">
    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
    
    <?php
session_start();  // Start Session
session_register("session");
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php
}
elseif (empty($email_address)) {
    echo $empty_fields_message;
}
else {
$email_address=mysql_real_escape_string($email_address);
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email_address,"@") OR !stristr($email_address,".")) {
$msg="Your email address is not correct<BR>"; 
$status= "NOTOK";}

echo "<br><br>";
if($status=="OK"){  $query="SELECT email_address,username FROM users WHERE users.email_address = '$email_address'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email_address;// email is stored to a variable
 if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='http://www.jackgodfrey.org.uk/register'>Register</a> </center>"; exit;}
function makeRandomPassword() { 
          $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
          srand((double)microtime()*1000000);  
          $i = 0; 
          while ($i <= 7) { 
                $num = rand() % 33; 
                $tmp = substr($salt, $num, 1); 
                $pass = $pass . $tmp; 
                $i++; 
          } 
          return $pass; 
    } 
    $random_password = makeRandomPassword(); 
    $db_password = md5($random_password); 
     
    $sql = mysql_query("UPDATE users SET password='$db_password'  
                WHERE email_address='$email_address'"); 
     
    $subject = "Your password at www.yoursite.com"; 
    $message = "Hi, we have reset your password. 
     
    New Password: $random_password 
     
    http://www.yoursite.com/login
    Once logged in you can change your password 
     
    Thanks! 
    Site admin 
     
    This is an automated response, please do not reply!"; 
     
    mail($email_address, $subject, $message, "From: yoursite.com Webmaster<admin@jyoursite.com>\n 
        X-Mailer: PHP/" . phpversion()); 
    echo "Your password has been sent! Please check your email!<br />"; 
    echo "<br><br>Click <a href='http://www.yoursite.com/login'>here</a> to login";
 } 
 else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
}
?>

    <p>&nbsp;</p>
<p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
  <div id="secondNavBar">
    <ul id="MenuBar2" class="MenuBarHorizontal">
      <li><a href="Index.php">Home</a></li>
      <li><A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A></li>
      <li><a href="TBRContactUs.html">Contact Us</a>      </li>
<li><a href="TBRAboutTBR.html">About Us</a>      </li>
      <li><a href="TBRUserAgree.html" class="MenuBarItemSubmenu">User Agreement</a>
        <ul>
          <li><a href="TBRTerms.html">Terms and Conditions</a></li>
<li><a href="TBRPrivacyPol.html">Privacy Policy</a></li>
        </ul>
      </li>
    </ul>
  </div>
</div>
</div>
</div>
  </div>
</div>
  </div>
  <div id="footer"><a href="Index.php">Home</a> | <A HREF="mailto:?subject=Useful Web Site!&body=http://www.TiredOfBeingRippedOff.ca">Email A Friend&nbsp;</A> | <a href="TBRContactUs.html">Contact Us</a> | <a href="TBRAboutTBR.html">About Us</a><a href="../TBRAboutTBR.html"></a> |<br />
  <a href="TBRUserAgree.html">User Agreement</a> | <a href="TBRTerms.html">Terms and Condiditons</a> | <a href="TBRPrivacyPol.html">Privacy Policy</a> | <a href="Register.php" title="Going to Register Page">Register</a></div>
</div>
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Open in new window

Thanks, Actually didn't see that. Is this better?

WC

Open in new window

Yes, I was wondering about that second session.

Anyway, retested and now get this error -
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /Library/WebServer/Documents/TBR/forgotpass.php on line 171

Line 171 is now this line -

$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
Change it like so:

$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class='two' href='javascript:history.go(-1)'>here</a> to go back";
Thanks, it now says - unexpected T Variable in line 173 which is now this line.

$email_address = $_POST['email_address'];

Following is the area that includes this code. This page is made up of code that I have taken from different pages in my site as well as code that I have saved so perhaps these are fighting with the original page code?

    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
    
    <?php
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class='two' href='javascript:history.go(-1)'>here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php

Open in new window

>> This page is made up of code that I have taken from different pages in my site as well as code that I
>> have saved so perhaps these are fighting with the original page code?

Probably.  I'll need another dump of the complete page code to try and find the misplaced quote mark...
Also, which version of PHP are you using?
I think I am using PHP 5 - definitely not 6.

Following is most of the code from the page.

Thanks

WC

<?php require_once('Connections/TBR.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_TBR, $TBR);
$query_Recordset1 = "SELECT * FROM IDTBR2010";
$Recordset1 = mysql_query($query_Recordset1, $TBR) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=md5($_POST['Password']);
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "MemberProfileTBR.php";
  $MM_redirectLoginFailed = "IndexIncorrect.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_TBR, $TBR);
  
  $LoginRS__query=sprintf("SELECT UserName, Password FROM idtbr2010 WHERE UserName=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $TBR) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Index</title>
<style type="text/css">
<!--
body {
	background-color: #FFF;
	text-align: center;
}
#wrapper {
	text-align: left;
	width: 900px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
}
#description {
	height: 150px;
	background-color: #DEA749;
	width: 894px;
	margin-left: 6px;
}
#header {
	margin-top: 12px;
	margin-bottom: 12px;
}
#footer {
	margin-top: 12px;
	margin-bottom: 12px;
	clear: both;
	padding-left: 6px;
}
#logo {
	height: 81px;
}
#slogan {
	height: 36px;
}
#content {
	height: 504px;
	margin-left: 6px;
}
#nav {
	height: 50px;
	width: 894px;
	background-color: #DEA74B;
	margin-left: 6px;
}
#secondNavBar {
	height: 40px;
	margin-left: 6px;
}
-->
</style>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="forms.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
  <div id="header">
    <div id="logo"><img src="Images/TBRlogoHoriz.jpg" width="900" height="81" alt="logo" /></div>
  </div>
  <div id="slogan">
    <p><img src="Images/TBRsloHoriz.jpg" width="900" height="36" alt="slogan" /></p>
</div>
  <div id="description"><img src="Images/Des.jpg" width="274" height="150" alt="Description" /><img src="Images/WhatItIs.jpg" width="185" height="150" alt="WhatItIs?" /><img src="Images/WhyWeNeedIt.jpg" width="225" height="150" alt="WhyWeNeedIt?" /><img src="Images/HowItWorks.jpg" width="210" height="150" alt="HowItWorks?" /></div>
  <div id="nav">
    <table width="700" border="0" align="right" cellpadding="3" cellspacing="0">
      <tr>
    <th width="525" align="right" scope="col"><label><a href="Register.php" onmouseout="MM_swapImgRestore()">Click The Register Button Or This Link To Join </a></label></th>
    <th width="175" align="right" scope="col"><a href="Register.php" onmouseout="MM_swapImgRestore()"><img src="Images/TBRRegister.jpg" alt="Going to Register Page" name="Register" width="126" height="27" border="0" align="left" id="Register" onclick="MM_swapImage('Register','','Images/TBRRegisterCL.jpg',0)" onmouseout="MM_swapImgRestore()" /></a></th>
  </tr>
</table></div>
  <div id="content">
    
    <?php
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class='two' href='javascript:history.go(-1)'>here</a> to go back";
// Convert to simple variables  
$email_address = $_POST['email_address'];
if (!isset($_POST['email_address'])) {
?>
<h2>Recover a forgotten password!</h2>
  <form id="ForgotPass" name="ForgotPass" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
    <label>Please Enter Your Email Address
      <input type="text" name="EmailAddress" id="EmailAddress" size="40"/>
        <label>
          <input type="submit" name="Submit" id="Submit" value="Submit" />
        </label>
  </form>
  <?php
}
elseif (empty($email_address)) {
    echo $empty_fields_message;
}
else {
$email_address=mysql_real_escape_string($email_address);
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email_address,"@") OR !stristr($email_address,".")) {
$msg="Your email address is not correct<BR>"; 
$status= "NOTOK";}

echo "<br><br>";
if($status=="OK"){  $query="SELECT email_address,username FROM users WHERE users.email_address = '$email_address'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email_address;// email is stored to a variable
 if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database . You can signup and login to use our site. <BR><BR><a href='http://www.jackgodfrey.org.uk/register'>Register</a> </center>"; exit;}
function makeRandomPassword() { 
          $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
          srand((double)microtime()*1000000);  
          $i = 0; 
          while ($i <= 7) { 
                $num = rand() % 33; 
                $tmp = substr($salt, $num, 1); 
                $pass = $pass . $tmp; 
                $i++; 
          } 
          return $pass; 
    } 
    $random_password = makeRandomPassword(); 
    $db_password = md5($random_password); 
     
    $sql = mysql_query("UPDATE users SET password='$db_password'  
                WHERE email_address='$email_address'"); 
     
    $subject = "Your password at www.yoursite.com"; 
    $message = "Hi, we have reset your password. 
     
    New Password: $random_password 
     
    http://www.yoursite.com/login
    Once logged in you can change your password 
     
    Thanks! 
    Site admin 
     
    This is an automated response, please do not reply!"; 
     
    mail($email_address, $subject, $message, "From: yoursite.com Webmaster<admin@jyoursite.com>\n 
        X-Mailer: PHP/" . phpversion()); 
    echo "Your password has been sent! Please check your email!<br />"; 
    echo "<br><br>Click <a href='http://www.yoursite.com/login'>here</a> to login";
 } 
 else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
}
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay Thanks. Will take a look at what I have done and attempt this again. Back to you in a couple of days.

WC
Thanks. Have postponed this for the time being.

WC