Page 2 of 2
Re: Linking the User Login Sytem to the Profile System
Posted: Mon Jan 09, 2012 11:32 pm
by jaymeh
Hi Temor,
I found one of our errors, the one on line 95 with the mysql, I was missing a ` after user_password.
My final issue now, at least I hope is the one of line 55 with the foreach() invalid arguement.
Although the valid credentials validation still isnt working correctly.
Re: Linking the User Login Sytem to the Profile System
Posted: Mon Jan 09, 2012 11:35 pm
by bowersbros
do a print_r($errors)
and see what you get.
Post the output here
Re: Linking the User Login Sytem to the Profile System
Posted: Mon Jan 09, 2012 11:58 pm
by jaymeh
Hi, where do I put print_r($errors)
on the login page?
EDIT: I got Username/Password incorrect.
EDIT: Which is the same as what I got when I tried to create the userlogin system a second time.
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 12:18 am
by Temor
if (valid_credentials($_POST['username'], $_POST['password']) === false)
try removing one of the equals signs.
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 12:31 am
by jaymeh
Nope, still not working
. If i change it to true, it works but so does every other user/password combination. Which is strange. The information I'm typing in is also correct. I even tried creating the whole login system again today. I have hit exactly the same problem.
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 12:59 am
by Temor
jaymeh wrote:Nope, still not working
. If i change it to true, it works but so does every other user/password combination. Which is strange. The information I'm typing in is also correct. I even tried creating the whole login system again today. I have hit exactly the same problem.
Hmm... Do you get the username and password if you
print_r($_POST);
?
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 1:35 am
by jaymeh
Yeah, they both show up. Its almost like they cant talk to the database which weird.
Array ([username] => jaymeh [password] => jaymeh
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 2:11 am
by Temor
are you sure you're establishing a connection to the database then? If you are then I'm clueless.
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 10:15 am
by jaymeh
Ill check the user exists function to see if that works because it means that im making a connection that way.
EDIT: There must be a connection since other sql functions work within the project. :/ I have no idea whats wrong with it...
$user = mysql_real_escape_string($user);
$pass = sha1($pass);
$total = mysql_query("SELECT COUNT (`user_id`) FROM `users` WHERE `user_username` = '{$user}' AND `user_password` = '{$pass}'");
return (mysql_result($total, 0) == '1') ? true : false;
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 1:41 pm
by Temor
I know whats wrong
You set password max length to 32 characters in your table. Sha1 will always produce a 40 character string.
32 characters won't match with 40
up your length limit to 40, re-register and it should work just fine
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 1:56 pm
by jaymeh
Hi Temor,
Thanks again. But I have passwords in the database which I have used to test but these passwords still do not work, unless the peice of code is looking for a password with sha1 coding in which case, I feel very silly
.
Ill have a look and test that now
Thanks again
Jamie
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 1:59 pm
by jaymeh
Hi Temor,
Right now I feel so stupid, that worked a treat, I''d like to thank you for all your help over the past few days
Happy coding
Thank again
Jamie
Re: Linking the User Login Sytem to the Profile System
Posted: Tue Jan 10, 2012 2:02 pm
by Temor
I'm happy we solved it
Should not have taken this long though. I should have spotted that earlier
If you're ever in need of help, don't hesitate to post. I'm on here most of the time.