...

View Full Version : Registration and login working offline, but not online?!



msredimp
03-06-2008, 12:05 AM
Thank you to everybody that helped, it seemed it was the md5 part of my code which was bugging up. I shouldn't have got involved with something I didn't know much about.

Inigoesdr
03-06-2008, 12:08 AM
Change your query to
$query = "SELECT * FROM users where login='$login' and pass='$password' LIMIT 1";
and

var_dump(mysql_num_rows($result)); if that doesn't work.

msredimp
03-06-2008, 12:17 AM
I changed the query to LIMIT 1, and that didn't work.

$query = "SELECT * FROM users where login='$login' and pass='$password' LIMIT 1";

I then added var_dump infront of that part and it didn't work, so I removed != 1 and got this error:

Parse error: syntax error, unexpected T_STRING, expecting '(' in ... on line 22

if var_dump(mysql_num_rows($result)) {

CFMaBiSmAd
03-06-2008, 12:18 AM
My guess would be that register globals are on and all your various program/post/session variables with the same name are overwriting each other.

Echo your query string in $query to see what it actually contains.

Your mysql_query() also has no error checking, so it could be failing, which will result in mysql_num_rows() having a false value and your code will only tell you that the login failed.

Each possible point of failure needs error checking (did it work or not), error reporting (tell the visitor a meaningful reason why the operation cannot be completed, and log all the available information for debugging purposes), and error recovery logic (what action do you take when there is an error, blindly continue executing on non-existent data or gracefully clean up and stop.)

rafiki
03-06-2008, 12:20 AM
if (var_dump(mysql_num_rows($result)))/* missing if's ()*/ {
infact why are you using an if?

var_dump(mysql_num_rows($result));
is the instructions, follow as told :)

Inigoesdr
03-06-2008, 12:20 AM
I changed the query to LIMIT 1, and that didn't work.

$query = "SELECT * FROM users where login='$login' and pass='$password' LIMIT 1";

I then added var_dump infront of that part and it didn't work, so I removed != 1 and got this error:

Parse error: syntax error, unexpected T_STRING, expecting '(' in ... on line 22

if var_dump(mysql_num_rows($result)) {
No, don't change your existing if condition, just add it before the if() and after the query.

msredimp
03-06-2008, 12:36 AM
Thank you everybody, problem solved. This thread is pretty useless as I was saying there was a problem where there wasn't. It was to do with the md5 part of my code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum