Forum Moderators: coopster

Message Too Old, No Replies

Session Start, not sure if it does first time

         

Tommybs

5:53 pm on Nov 3, 2009 (gmt 0)

10+ Year Member



Hi all,

I'm wondering if someone can help me. I've been building myself an authentication class to handle logins and check users etc. Apart from one issue it's all working as I would expect.

The issue I'm having though is causing me to pull my hair out and I'm not sure how best to debug. Basically when people try to login they have to enter their details twice, and the 2nd time through it seems to be setting the sessions correctly and logging them in.

Now if the user tries to go to a page that requires them to login, it redirects them to the login page. As this is the 2nd page they've visited it logs them in on first try.

I'm starting the session correctly, but it seems like someone has to visit a least 1 page before trying to login. I'm not sure why this is happening.

Would anybody have any ideas here?

Tommybs

6:10 pm on Nov 3, 2009 (gmt 0)

10+ Year Member



Right, I've actually managed to work out what's wrong and it's not to do with sessions. I've got a check on my form to check that the referrer was equal to the actual script name.
When I navigated to mysite.com and enter the info the function that checks if the login was ok redirects to mysite.com/index.php, when i submit the info direct to this it works as expected. I'm guess I either need to redirect to index.php or alter the check somehow.

Nevermind all!