• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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();


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.