Hi,
I can't copy my complete site, but
here's the complete code of that certain page.
The problem is: while showing the warning
" Your address is not there in our database ... ",
the sidebares on the right and the footer are missing.
But the other warning "Your email address is not correct" is working perfect
without distroying the sidebar or footer.
So I think there's a bug in this code. So, it's not my HTML or CSS,
code I think.
<?php
include "include/session.php";
include "config.php";
$email=$_POST['email'];
$site_url="www.mysite.com";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>forgot password</title>
</head>
<body>
<?php
$email=mysql_real_escape_string($email);
$status = "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email,"@") OR !stristr($email,".")) {
$msg="Your email address is not correct<br/>";
$status= "NOTOK";}
This part should have the bug:
echo "<br/><br/>";
if($status=="OK"){ $query="SELECT email,userid FROM plus_signup WHERE plus_signup.email = '$email'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email;//
When he shows the following warning it's going wrong an the sidebars and footer
are gone:
if ($recs == 0) { echo "<br/> Sorry Your address is not there in our database .
You can signup and login to use our site. <br/><br/><a href='signup.php'> Sign UP </a>"; exit;}
$tm=time() - 86400;
if(mysql_num_rows(mysql_query("SELECT userid FROM plus_key WHERE userid = '$row->userid' and time > $tm and status='pending'"))){
echo "<strong>Your password activation Key is already posted to your email address, please check your Email address & bulk mail folder.</strong> ";
exit;
}
function random_generator($digits){
srand ((double) microtime() * 10000000);
//Array of alphabets
$input = array ("A", "B", "C", "D", "E","F","G","H","I","J","K","L","M","N","O","P","Q",
"R","S","T","U","V","W","X","Y","Z");
$random_generator="";// Initialize the string to store random numbers
for($i=1;$i<$digits+1;$i++){ // Loop the number of times of required digits
if(rand(1,2) == 1){// to decide the digit should be numeric or alphabet
// Add one random alphabet
$rand_index = array_rand($input);
$random_generator .=$input[$rand_index]; // One char is added
}else{
// Add one numeric digit between 1 and 10
$random_generator .=rand(1,10); // one number is added
} // end of if else
} // end of for loop
return $random_generator;
} // end of function
$key=random_generator(10);
$key=md5($key);
$tm=time();
$rt=mysql_query("insert into plus_key(userid, pkey,time,status) values('$row->userid','$key','$tm','pending')");
echo mysql_error();
$headers4="admin@sitename.com";
$headers.="Reply-to: $headers4\n";
$headers .= "From: $headers4\n";
$headers .= "Errors-to: $headers4\n";
//$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;// for html mail un-comment this line
$site_url=$site_url."activepassword.php?ak=$key&userid=$row->userid";
if(mail("$em","Your Request for login details","This is in response to your request for login detailst at site_name \n
\nLogin ID: $row->userid \n To reset your password, please visit this link( or copy and paste this link in your browser window )\n\n
\n\n
$site_url
\n\n
<a href='$site_url'>$site_url</a>
\n\n Thank You \n \n siteadmin","$headers")){echo "<strong>Thank you</strong> <br/>Your password is posted to your emil address . Please check your mail after some time. ";}
else{ echo "There is some system problem in sending login details to your address.
Please contact site-admin. <br/><br/>
<input type='button' value='Retry' onClick='history.go(-1)'>";}
}
else {echo "$msg <br/><br/><input type='button' value='Retry' onClick='history.go(-1)'>";}
?>
</body>
</html>
Thank you!