Customizing SMF > SMF Coding Discussion

Why does Login2() get called twice when logging in

(1/1)

Red Squirrel:
I wrote a central authentication system for my site and I want the forum to authenticate to it as well.

I got it sort of working but I noticed that login2() (located in loginout.php within sources folder) which is the actual login sequence seems to always get called twice when you log in.  This is creating two sessions on the remote server instead of one as it's calling the custom authentication code twice.  The weird part is, if I put any echo() debug info within that function none of it shows up even though I can clearly see that some of that code is executing because I also have stuff writing to a file. 

I also have another sudden issue with account creation that I'm dealing with which I think has to do with this fact as well.

Can someone explain what is going on in the back end and why this is being called twice?  There's lot of weird stuff that seems to be happening in the background that I can't wrap my head around and this is one of them.

vii:
echo() is not showing up because the page redirects away before you can see any page output. You can use log_error() to put your message into the error log so you can examine it afterwards. SMF sends the client back to action=login2;sa=check to verify the session was created.

Red Squirrel:
Good to know about the log_error() function, will try to play around with that.  At this point I don't know for sure if it's my own code somehow making it being called twice or not so it will help me troubleshoot at least.

live627:
My favorite trick with log_error() is to combine it with var_export($var, true) to get a dump of arrays in the log.

Navigation

[0] Message Index

Go to full version