Welcome Guest, Not a member yet? Register   Sign In
Run function only once, when user enters web site
#1

[eluser]Unknown[/eluser]
Is there some way to run function only once, when user load web site? I have a function which, based on the IP of the user, determines country of the user, and I need it to run at the start so that the language of the site is automatically set (via SESSION), and later if there is need, user can change language via button.
#2

[eluser]PhilTem[/eluser]
MY_Controller::__construct() business logic explained in words:

if ( session has no information about language )
check the language based on ip, etc. pp.
save the information in the session
#3

[eluser]ramirors[/eluser]
if ( !$this->session->userdata('country') ) $this->yourlibrary->set_ country();




Theme © iAndrew 2016 - Forum software by © MyBB