mmarif4u Posted December 5, 2007 Share Posted December 5, 2007 Hi to all. I am working on a site,its in english.now my company decided to make another version for the site. Everything i already make and working fine. Just the problem is lang switching. for example if user select the BM lang and then he want to login to the user area,so how can the script will recognize that user choses the BM lang. I have 2 ideas about this: 1-store in db and then retrieve it later in login script. 2-store in session About 1st option i am not sure,bcz at the same moment alot of user will access site,and b4 user login cannot store that to specific user id. Now 2nd option is a bit simple but i need some more information,how to do it and will it be stable in future and secure. Thanks in advance for any comments. Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 5, 2007 Share Posted December 5, 2007 I would use a combination of Cookies and Session variables. You will never know the correct language the first time a user visits your site, thus the login page must hav a selection. BUt, once a cookie is set you can use that whenever the user revisits your site. However, if the user has Cookies disabled you can use Session data to at least remember their language for each visit. Saving the language selection to the database is an optioin, but it will not remember their selection until after they log in. So, you could use the DB value as a third parameter if you wish but I think it's use would be limited - i.e. it would only take effect once they log in and you would either need to query the DB on every page or save the value to a session variable anyway. Take a look at the script I posted in this thread: http://www.phpfreaks.com/forums/index.php/topic,159661.0.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.