Jump to content

Recommended Posts

When the user tries to login it does not recognise their password. so if they type in their password it does not login but if they leave the password field blank, it does.

 

<?php

require_once ('page_header.php');

session_start();
$username = $_POST['username'];
$password = md5($_POST['password']);

$query = "SELECT * FROM users WHERE username='$username' and password='$password'";

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = 'Bad Login';

//html code

	if($_POST){
		print ("<font color=\"#ff0000\"> \n");
		print ("<center> \n");
		echo ("Incorrect Username and Password combination.");
		print ("</center> \n");
		print ("</font> \n");
		require_once ('page_footer.php');
	}

} else {
    $_SESSION['username'] = '$username';
    require_once ('memberspage.php');
}

?>

 

Thanks in advance,

 

~ Chocopi

Link to comment
https://forums.phpfreaks.com/topic/51223-solved-n00b-login-problem/
Share on other sites

ok i found the problem but it looks fine to me

 

if ($raw_password !== $raw_confirm){
echo ("Your passwords must be identical.");
require_once ('page_footer.php');
die ("");
} else {
$password = md5($_POST['raw_password']);
}

 

The idea of this is that it validates the raw_password and raw_confirm and if it is true then it sets the md5 of raw_password to $password. But it hasnt worked :'(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.