Jump to content

Login Code issues (mysql_fetch_assoc)


Foser

Recommended Posts

R u want to match the password in the row against username.

I did not see any query for that.

Ok try this may be it will work.

 

SELECT * FROM user_info WHERE username = '$user' and password='$pw'

If this doesnot work than try this.

 

$pw =$_POST['pw'];
SELECT * FROM user_info WHERE username = '$user' and  md5(sha1(md5(md5('password')='$pw'

 

<?php
require("config.php");

$user = mysql_real_escape_string($_POST['user']);
$pw = $_POST['pw'];

mysql_fetch_assoc(mysql_query("SELECT * FROM user_info WHERE username = '$user' and md5(sha1(md5(md5(password)))) = '$pw'")) or die(mysql_error());

if ($pw == $user_info['password'] && $user == $user_info['username']){
mysql_fetch_assoc(mysql_query("SELECT rights FROM user_info WHERE username = '$user'")); 
echo "You are now logged in as a $user_info[rights]."; }
else {
echo "You have typed in an incorrect password or/and username. Please try again."; }

?>

 

This is my edited code

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.