Log in problem

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

<?php /* <?php require_once('../../Connections/myconnection.php'); ?>

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
?>

Login to your profile body,td,th { color: #390; } body { background-color: #000; } input { background-color: #FFF; font-size: 16px; font-weight: 900; }



Log in to your account here

<?php /* Created By Adam Khoury @ www.developphp.com -----------------------June 19, 2008-----------------------*/ //*** "die()" will exit the script and show an error if something goes wrong with the "connect" or "select" functions. //*** A "mysql_connect()" error usually means your connection specific details are wrong //*** A "mysql_select_db()" error usually means the database does not exist. // Place db host name. Usually is "localhost" but sometimes a more direct string is needed $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 heretest $db_name = "webdes42_1";include_once "connect_to_mysql.php"; $sql="SELECT * FROM $tbl_name WHERE username='.addslashes($myusername).' and password='.addslashes($mypassword).'";

if($logged_in == 0) {
?>

<?php } ?>
  </form>
</table>
</body>

Email Address:

Password:

 

I would suggest that you throw that tutorial away and searching the internet for a newer tutorial…heck you might find one even here. ;D

This one was ok my register form works and email actives works only log in page doesn’t work.My log in page is not checking for date base already registered users.If you have some better tutorial here please help me.If it is possibly video tutorial with codes in some folder.

Sponsor our Newsletter | Privacy Policy | Terms of Service