g8rnc Posted January 17, 2011 Share Posted January 17, 2011 I need help with the attached script. I am using ipage.com to host and when I log in with credentials that have been placed in the database I just get the login prompt coming up every time. There is no die action that says access failed or anything. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/224743-noob-help-needed-login-script/ Share on other sites More sharing options...
Maq Posted January 17, 2011 Share Posted January 17, 2011 What have you done to debug this issue? Are you sure you're not logged in and the login screen just isn't being hidden? I would start by echoing out inside some of your if statements to see where it's getting caught up. Also echo out some of your variables like '$token' & '$row[3]'. Quote Link to comment https://forums.phpfreaks.com/topic/224743-noob-help-needed-login-script/#findComment-1160931 Share on other sites More sharing options...
g8rnc Posted January 17, 2011 Author Share Posted January 17, 2011 Thanks for your help, I appreciate it. I put echo statements on line 10, right after the if (isset) statement. I also put an echo on line 18, right after the elseif statement. I also put an echo on line 25 right after the if ($token == row[3]). When I ran it, I saw none of the echos. It still did the same thing and when I hit cancel on the login screen it takes me to a page that says "Please enter your username and password", which is on line 41. I also tried to put an echo on line 7 before the if statement and when I open the page I get the echo followed by this message: Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web016/b161/ipg.mysite/authenticate2.php: in /hermes/bosweb/web016/b161/ipg.mysite/authenticate2.php on line 44 I also wanted to note that it doesn't matter if I type in a correct username/password or an incorrect username/password, the pop-up box to login still pops up. Quote Link to comment https://forums.phpfreaks.com/topic/224743-noob-help-needed-login-script/#findComment-1160964 Share on other sites More sharing options...
Maq Posted January 17, 2011 Share Posted January 17, 2011 I put echo statements on line 10, right after the if (isset) statement. I also put an echo on line 18, right after the elseif statement. I also put an echo on line 25 right after the if ($token == row[3]). When I ran it, I saw none of the echos. It still did the same thing and when I hit cancel on the login screen it takes me to a page that says "Please enter your username and password", which is on line 41. So your $_SERVER['PHP_AUTH_USER'] and/or $_SERVER['PHP_AUTH_PW'] aren't being set. I also tried to put an echo on line 7 before the if statement and when I open the page I get the echo followed by this message: Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web016/b161/ipg.mysite/authenticate2.php: in /hermes/bosweb/web016/b161/ipg.mysite/authenticate2.php on line 44 That's fine. Quote Link to comment https://forums.phpfreaks.com/topic/224743-noob-help-needed-login-script/#findComment-1160975 Share on other sites More sharing options...
g8rnc Posted January 17, 2011 Author Share Posted January 17, 2011 Why would those not be set? Sorry, I have some programming background, but I just started teaching myself PHP and MySQL. I googled my issue and found someone saying if phpinfo() shows CGI/FCG under the Server API section that there is no way to do what I am trying to do. I ran phpinfo() and under Server API it says CGI. Quote Link to comment https://forums.phpfreaks.com/topic/224743-noob-help-needed-login-script/#findComment-1160984 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.