Linking the User Login Sytem to the Profile System

Post here is you are having problems with any of the tutorials.
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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. :(
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Linking the User Login Sytem to the Profile System

Post by bowersbros »

do a print_r($errors)

and see what you get.

Post the output here :)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Linking the User Login Sytem to the Profile System

Post by Temor »

        if (valid_credentials($_POST['username'], $_POST['password']) === false) 
try removing one of the equals signs.
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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. :(
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Linking the User Login Sytem to the Profile System

Post 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);
?
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post by jaymeh »

Yeah, they both show up. Its almost like they cant talk to the database which weird.

Array ([username] => jaymeh [password] => jaymeh
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Linking the User Login Sytem to the Profile System

Post by Temor »

are you sure you're establishing a connection to the database then? If you are then I'm clueless.
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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;
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Linking the User Login Sytem to the Profile System

Post 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 :)
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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
jaymeh
Posts: 27
Joined: Wed Jan 04, 2012 12:42 pm
Location: West Yorkshire

Re: Linking the User Login Sytem to the Profile System

Post 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
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Linking the User Login Sytem to the Profile System

Post 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.
Post Reply