I have problem with log in page.My register form works perfectly and after registration on email i getting link which activated my account.But problem is log in page every time i tried to log in i getting message No match in our records, try again ,even when all information’s i can see in date base email and password.
If you please can help with some tutorial or better video how to avoid this problem.Or even better over the Skype.This is code for my log in page
www.flashbuilding.com
----------------------June 20, 2008-----------------------
*/
if ($_POST[‘email’]) {
//Connect to the database through our include
include_once “connect_to_mysql.php”;
$email = stripslashes($_POST[‘email’]);
$dbemail=mysql_real_escape_string($email, $connection);
$db_host = “localhost”;
// Place the username for the MySQL database here
$db_username = “webdes42”;
// Place the password for the MySQL database here
$db_pass = “nepokusavaj”;
// Place the name for the MySQL database here
$db_name = “webdes42_1”;
//start validations
//validate email
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$password =preg_replace ("[^A-Za-z0-9]", “”, $_POST[‘password’]); // filter everything but numbers and letters
$password = md5($password);
// Make query and then register all database data that -
// cannot be changed by member into SESSION variables.
// Data that you want member to be able to change -
// should never be set into a SESSION variable.
$sql = mysql_query(“SELECT * FROM members WHERE email=’$email’ AND password=’$password’ AND emailactivated=‘1’”);
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
// Get member ID into a session variable
$id = $row[“id”];
session_register(‘id’);
$_SESSION[‘id’] = $id;
// Get member username into a session variable
$username = $row[“username”];
session_register(‘username’);
$_SESSION[‘username’] = $username;
// Update last_log_date field for this member now
mysql_query(“UPDATE members SET lastlogin=now() WHERE id=’$id’”);
// Print success message here if all went well then exit the script
header(“location: member_profile.php?id=$id”);
exit();
} // close while
} else {
$sql=“SELECT * FROM $tbl_name WHERE members=’.email=’$email’.’ and password=’$password’ AND emailactivated=‘1’.’”;
// Print login failure message to the user and link them back to your login page
print ‘
No match in our records, try again
Click here to go back to the login page.’;
exit();
}
}// close if post
?>
Log in to your account here
Email Address: |
|
Password: |
|