Forum Moderators: coopster

Message Too Old, No Replies

wrong password.even though its correct.

         

surrealillusions

2:09 pm on Feb 1, 2008 (gmt 0)

10+ Year Member



I'm trying to create a login page to a members only page/area by creating a cookie.

I've ironed out all the syntax errors. The script checks if the cookie exists or not. If not, then it displays the login form. Of course first time testing it, cookie doesn't exist, so i have to login. It checks the user and pass against a database where the user and pass is stored. However, despite typing the correct user/pass, it says the password is wrong..

I'm using the script from this tutorial

[php.about.com...]

Except i'm not using the registration bit. I've entered the user/pass directly into the database using phpmyadmin.

Plus there are some errors in the script in that link, such as the 'else'

}
else
{
header("Location: members.php");

}
}
}

There that shouldn't be there as it gives me an error, and 1 } too many as well.

:)

henry0

3:10 pm on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I bet the password format is incorrect
Is your script trying to match an md5 PW or is using another format?

When you entered your PW by using phpMyAdmin
Did you md5 it first?

omoutop

3:10 pm on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



- check if password is encoded with md5() or anything like this. Since you insert data directly iunto db you may have to encode your password

- check spelling of submitted data. Capital/lower case letters do affect your query results

- on the errors: make sure you hace all the script - some times you forget to copy some part because a popup banner is in the way. Try to use a download link if available

And please... do not post urls with scripts here. Refer to TOS part of forum for info

omoutop

3:11 pm on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



:) henry0 got me first :)

surrealillusions

3:43 pm on Feb 1, 2008 (gmt 0)

10+ Year Member



ok..cant edit the post to edit out the url...is there an easy way to post the script without making the page a few miles long? Had a quick check of the tos's but couldn't see anything about posting links to scripts..? I know personal/promotional url's aren't allowed...so thought scripts would be ok..

Anyway...it might be the encoded bit with the md5. As thats used in the script.

Need to figure out then how to encode the password with phpmyadmin.

thanks

:)

henry0

3:48 pm on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$str="secretpassword";
$password=md5($str);
echo"My PW: $password";
copy its hashed value, paste it in phpMyAdmin

surrealillusions

4:21 pm on Feb 1, 2008 (gmt 0)

10+ Year Member



I've encoded the password when entering the password thru phpmyadmin..however it still says the password is wrong..i've checked and double checked i'm entering it all correct. Emptied the database and re-entered the information..but to no avale..

:/

henry0

4:36 pm on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Be sure to remove from the query/queries
any: @ (if any)

add in your query "die"
for example: $result=mysql_query($sql) or die(mysql_error)());
this will throw any DB error

for script error
at the top of your page
but bellow session_start() if any session is used.
type: error_reporting(E_ALL);

then repport your findings