Jump to content

NOOB Help Needed - Login Script


g8rnc

Recommended Posts

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]

Link to comment
Share on other sites

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]'.

Link to comment
Share on other sites

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:8) 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.

Link to comment
Share on other sites

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:8) in /hermes/bosweb/web016/b161/ipg.mysite/authenticate2.php on line 44

 

That's fine.

Link to comment
Share on other sites

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.

Link to comment
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.