Skip to main content
August 5, 2006
Answered

How to create a login to users in PHP

  • August 5, 2006
  • 2 replies
  • 488 views
How to create a login for users to access their data, currently I can only see the first user everytime I login even with a different username. I know I need session stuff but don't know how to use, add or where to put them in.
Thanks in advanced.
This topic has been closed for replies.
Correct answer
Hi

Find this in your login page:

session_register("MM_Username");

and then add a session variable in MX called this:

MM_Username

then on any of your pages that calls from the database make sure that you use the = MM_Username and then you are all set; make sure that the tables have a field to reference the session variable MM_Username.

Cheers
Let me know if you come right!

2 replies

November 7, 2006
I also am wrestling with the same problem. Session variables have not worked. I have determined that if the GET method is used, then the recordset of the users records are there. If the POST method is used, the recordset is blank. It appears to be something inherent in the Log In User behavior.
I am trying to have a customer log in and then only see their particular inventory records. I do not want them be directed to a page with a listing of all the various customers and then select from that. Not suitable at all.
If I find an answer, will let you know.
Thanks and good luck,
Dale :-)
Correct answer
November 13, 2006
Hi

Find this in your login page:

session_register("MM_Username");

and then add a session variable in MX called this:

MM_Username

then on any of your pages that calls from the database make sure that you use the = MM_Username and then you are all set; make sure that the tables have a field to reference the session variable MM_Username.

Cheers
Let me know if you come right!
August 7, 2006
You should have your user info in a database. When the user logs in, check the username and password against what's in your database. If they don't match, provide an error. If they do match, you can assign the username to a session variable and display that on the page.
August 8, 2006
Yes but how and where to put the sessions?