Jump to content

Recommended Posts

Hello again everyone.

 

I had an issue a few weeks back with a field reference that a member of this board helped me with. 

 

Since then, I forgot my logon and had to re-register... oh well.  I apologize for this new logon.

 

My problem is this.  I tried to test data in our online database today and now am totally unable to logon.  It is like the user email and password fields are not in sync? 

 

Remember that I am very new to php and inherited a system that no one accesses right now but me.  I have not changed any references. 

 

Again, this has to be a field reference to one of a few tables.  I can upload the login.php and associated table/field structure if it would help. 

 

Can someone please give me a hand on fixing this?

Link to comment
https://forums.phpfreaks.com/topic/204326-new-login-problem/
Share on other sites

I would start out of echo'ing out variable contents and putting a die(); on the line after, and keep doing that to "debug" your code to see where exactly it's messing up.  start with the page you check credentials against the database.  echo the password from the database and echo the password from the user and stop the code with die(); and see if they match.  check to see that your session variable saying they're "logged in" is set correctly.  that's my typical method of debugging stuff.  not the greatest method but for me it works.

Link to comment
https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070351
Share on other sites

The error message I get is:

 

"Either your email or password is incorrect."

 

I checked the table that has the two fields in it (email and password.)  I even changed them (and saved) only to get the same email.  When I logon other areas (same db connection) the Admin and Buyer works fine.

 

Somehow it is not reading the email and password in the 'Supplier' table or is pointing to the wrong ID (the table was set up with an 'ID' field as well as 'Supplier ID' field.  It needs to use the Supplier ID.

 

Somehow I think this is tied to the previous problem where a Supplier would login and when viewing products (should only be able to see their own) were seeing all products from all suppliers. 

 

Does this help isolate where the problem is? 

Link to comment
https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070358
Share on other sites

not exactly, but like I said, you should echo out both the database values and the user entered credentials and stop the code from executing with die(); and you'll see exactly what's going on by viewing the contents of variables.  it's the quickest way to pinpoint where your problem is coming from =)

 

for example, if your login page POSTs to check.php then on THAT page you echo everything out and so after you try logging in you can see where and why things aren't matching up.

Link to comment
https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070361
Share on other sites

Here is the only change that was made.  This is what solved my other problem.  (I still appreciate the help in solving this.)

 

Login.php:  Old line 49 was: 

                  query_mysql("INSERT INTO `Sessions` (`Cookie`, `User ID`, `User Type`, `Activity`, `Login`) VALUES ('" . escape($temp) . "', '" . escape($user["ID"]) . "', 'Supplier', '" . time() . "', '" . time() . "')");

 

Login.php:  New line 49 is:

                  query_mysql("INSERT INTO `Sessions` (`Cookie`, `User ID`, `User Type`, `Activity`, `Login`) VALUES ('" . escape($temp) . "', '" . escape($user["Supplier ID"]) . "', 'Supplier', '" . time() . "', '" . time() . "')");

 

The ID was changed to Supplier ID.

Link to comment
https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070363
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.