Jump to content

Archived

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

chapm4

help with user validation

Recommended Posts

Please help me before I lose what is left of my mind. I won't put any code here, because mine doesn't work anyway and I would like to satrt from scratch.

A user comes to the main page of the site. They click on customer to go to a customer-login.php page. This page has username and password on it. When they click submit it goes to a page called loginaction.php. This page validates by cookie the username and password. If those are correct the user is taken to their own page such as customerabc.com. They then fill out an order form, click submit and their order is sent through an email to the company for processing.

The company now wants me to convert the site to mysql for obvious reasons.

on my customer-login.php I have two includes....one is to connect to the database and the other is to login to the database. Both of these work fine. I have one table so far which is called login - it contains the fields username, password, lastLogin, loginId. I set up a page where I pull the data out of those fields and again it works fine. The problem comes when I try to validate that the user that has just entered their information onto the customer-login.php page. I cannot get anything I try to work.

Again, I want the user to enter username and password, these to be validated with the database, and if correct the user will go to their own customer page. What seems like it should be so easy has given me hours of grief. I have used other peoples code snippets as well as writing my own. Can someone please help me accomplish this task where it works? Thank you.....

Share this post


Link to post
Share on other sites
I'm not really sure I understand what you want help with -- you validate a user/pass pair against a users table, and then find that user_id in the customers table, and take them to a customers page with their info loaded. Where exactly are you running into trouble?

Share this post


Link to post
Share on other sites
Sorry if I didn't make it very clear.

I successfully log into the database with my new include files. I have the old username and password login page (from the old pre-database site) but don't know how to convert that to validate the user in my new sql table (called login). The old site then went to a certain page based on that user. I don't know how to do this in php/mysql.

Share this post


Link to post
Share on other sites
Again, same question -- is the problem validating the user/pass against the table, or redirecting the validated user to a specific page? I don't see what the old system has to do with this.

Share this post


Link to post
Share on other sites
Yes to both things you have said. When I try to validate the user against what is in the database I get a blank page, so I need help with that (I thought it would be better if you helped me from scratch on that page). To validate a user against a database.

And yes to the second part. After I validate the user logging in against the database, I have no idea how to send that user to a specific page based on that user (such as customerA.psp or customerB.psp).

Share this post


Link to post
Share on other sites
I'm confused -- a blank page? What did you ask it to do? And you can redirect using PHP's redirect function.

Share this post


Link to post
Share on other sites
[!--quoteo(post=343201:date=Feb 6 2006, 07:49 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 6 2006, 07:49 PM) [snapback]343201[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'm confused -- a blank page? What did you ask it to do? And you can redirect using PHP's redirect function.
[/quote]

What I am really asking is for is a tutorial (I can't find one) on the following:
A user comes to the site.
They enter a username and password
The username and password is validated against the login table in mysql
The user is taken to their own individual page with custom graphics and such

Share this post


Link to post
Share on other sites
I don't know of any particular tutorial.

Like I said, you have the user/pass, simple query the users table, and see if you find a matching record or not, and login them in appropriately.

When you say "individual" page, I think you mean a template page that pulls user-specific info from the DB. Again, easily accomplished with PHP, but I can't think of a tutorial off-hand that would serve a good starting point.

Good luck.

Share this post


Link to post
Share on other sites

×

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.