News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Logging In

Started by IceXaos, September 08, 2010, 04:17:41 AM

Previous topic - Next topic

IceXaos

Is there a way to load a script when you log in, for example I want Javascript & HTML, but only when you log in, so it does it that one time, and it's done while you're usin' the site.

I hope you understand what I mean, and please/thank you for any help.

Joker™

if ($context['user']['is_logged'])
{echo ' your script
}
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

IceXaos

Quote from: Joker™ on September 08, 2010, 04:22:31 AM
if ($context['user']['is_logged'])
{echo ' your script
}
Would this go where though?  I know how to check if they're logged in, but not sure if I could have it only load one time after they log in.  LogInOut.php somewhere?

Joker™

in the file where u want to put the code. in my site something comes in header for guests , to provoke them for register. and after they login , code is gone . so the code is placed in index.template.php
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

IceXaos

Quote from: Joker™ on September 08, 2010, 06:15:49 AM
in the file where u want to put the code.
I mean, where would I put it to have it go off only once after logging in?  If I just throw it on the index or something, they'll have it go off every time they go to that page.  For us, it's kind'a useless and extremely annoying if it'd go off all the time, as it only works once per day.

IceXaos

Would I be better off just addin' a check for cookie, if doesn't exist execute and set cookie for 24 hours?

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

IchBin™

If you want to do it every time they login, just add something to the $_SESSION. If what you add does not exist in the $_SESSION then execute your script.
IchBin™        TinyPortal

Advertisement: