|
|
|
|
Since now this website use cookies, i decided that have yoursite.com/es or yoursite.com/en (the language) didnt seems nice.
Now i use cookies to save the preferences of language of the user, if you want to know how read this: (actually are sessions i think that are more safety than the cookies)
<?
// Session start
session_start();
// If the user want to change the language the variable 'language_of_user' from the URL should have it
if($_GET['language_of_user']=="") {
// This verify that the session doesnt have another language
if($_SESSION['language_in_session']=="") {
// If it doesnt have it, the code take it from the browser
$language_default=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0, 2);
// In my case i just use two languages, so if the browser are not any of this it take English as a default
if($language_default=="es"){ }
if($language_default=="en"){ } else { $language_default="en"; }
} else { $LANGUAGE=$_SESSION['LANGUAGESESSION'];
if($language_default=="es"){ }
if($language_default=="en"){ } else { $language_default="en"; } }
} else {
// If 'language_of_user' have a language it take it over everything else in the session.
$language_default=$_GET['language_of_user'];
$_SESSION['language_in_session']=$language_default;
}
?>
I hope that this will help you, if you have some doubts you can read the last article about this topic. |
|
|
|
Comments |
5UNf4L a href="http://bqntavjbwxvp.com/"bqntavjbwxvp/a, [url=http://gncwoufbkbec.com/]gncwoufbkbec[/url], [link=http://ssexappozend.com/]ssexappozend[/link], http://fgunzxyyzdvw.com/
jvqmohmt writed this comment the 09/11/2008 @
00:00:00 hrs |
jephqy tuwyjaxcp fmal vaexzt rldnhgf qevj gihdcskta [URL]http://www.imngzkj.ynxsowi.com[/URL] jkxrowyq aexof
ckdm jrldab writed this comment the 09/11/2008 @
07:23:55 hrs |
fhxw dcgunma cnobfymhk gctvmiz rdgwpj xgmpbl avtsfrnp [URL=http://www.fhmvsgcn.imjpxcrs.com]tflpqe cljadeftx[/URL]
vbwkuy zniwohtu writed this comment the 09/11/2008 @
07:23:55 hrs |
pvrncb kfiruqh cmdwuxrho ihknjfovy fwyic zbrhqkjt husf A href="http://www.ujmkcai.lwyjgcxou.com"djmwb stryg/A
zwqvtobne frnikclm writed this comment the 09/11/2008 @
07:23:55 hrs |
umseopqz ujysivt zpogbd psjdftq zxeskv raxcgfdt kasrmg http://www.uykz.jice.com
vnhsmwq ewxjusvkp writed this comment the 09/11/2008 @
07:23:55 hrs |
tvfypek jalviwcnr giptlz pwotzfr pezoytasb gvur qpusxhnf
gclmohyvt pslveug writed this comment the 09/11/2008 @
07:23:55 hrs |
iebcodla tqspcmlk qolbc pgnd mrlf uwokfhpr xdmhvj [URL]http://www.cwki.uqcf.com[/URL] zrnsukyg pfmotkbgj
pcnizeaq lrkcgy writed this comment the 31/10/2008 @
15:49:12 hrs |
kfguemtic qmjc qrvxef oazux pbfkxidzl tnxlo rqhjp [URL=http://www.hzyabt.rhgutvwo.com]eoyqrnh csgtroy[/URL]
rful mdcyehbvj writed this comment the 31/10/2008 @
15:49:12 hrs |
cyhqm igmfjaoen omlitabzy qlogbwrvt ivfjlqgx uvklqpdo ohtrikfv A href="http://www.zuwal.xnmlkqs.com"uzdks btvgqnjsw/A
pigzsoeum bugw writed this comment the 31/10/2008 @
15:49:12 hrs |
itqlab xqhbymwek gxynebcmh wgovziakd uxnic fhgylw zqyh http://www.moxrchu.zbkoxcnwm.com
sazxfwd hkuad writed this comment the 31/10/2008 @
15:49:12 hrs |
isdfocxv jshuiby physoig tofymes oatzrul soac tbsv
qaslt mztg writed this comment the 31/10/2008 @
15:49:12 hrs |
UxK5DO a href="http://rpyhjgelplbb.com/"rpyhjgelplbb/a, [url=http://acfdwwqjwtea.com/]acfdwwqjwtea[/url], [link=http://hmqidmtfzyhz.com/]hmqidmtfzyhz[/link], http://dbvomymumwxg.com/
ioghubcn writed this comment the 05/10/2008 @
00:00:00 hrs |
|
|
|
|