PBD817 Posted June 9, 2010 Share Posted June 9, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/ Share on other sites More sharing options...
frozenmafia Posted June 9, 2010 Share Posted June 9, 2010 post your login.php please. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070094 Share on other sites More sharing options...
syed Posted June 9, 2010 Share Posted June 9, 2010 Have you checked the db table to make sure the login credentials are correct. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070105 Share on other sites More sharing options...
PBD817 Posted June 9, 2010 Author Share Posted June 9, 2010 Here is the login.php [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070106 Share on other sites More sharing options...
PBD817 Posted June 9, 2010 Author Share Posted June 9, 2010 Yes, The login db structure uses three different user tables (buyers, suppliers and administrators) I can login as an admin with no problem. The db connectivity server/password is correct. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070109 Share on other sites More sharing options...
PBD817 Posted June 10, 2010 Author Share Posted June 10, 2010 Thanks again for any help. This PHP project is making me age prematurely. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070329 Share on other sites More sharing options...
5kyy8lu3 Posted June 10, 2010 Share Posted June 10, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070351 Share on other sites More sharing options...
PBD817 Posted June 10, 2010 Author Share Posted June 10, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070358 Share on other sites More sharing options...
5kyy8lu3 Posted June 10, 2010 Share Posted June 10, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070361 Share on other sites More sharing options...
PBD817 Posted June 10, 2010 Author Share Posted June 10, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070363 Share on other sites More sharing options...
PBD817 Posted June 10, 2010 Author Share Posted June 10, 2010 Any thoughts yet. I cannot figure this one out. (Being inexperienced in this is not much fun.) Quote Link to comment https://forums.phpfreaks.com/topic/204326-new-login-problem/#findComment-1070453 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.