html - PHP - link for actual language id -
so i'm building small multilingual (french + english) website , there little bug. remove "english default" language in code, if user picks french on 1 page, page select afterwards in french , not "back" english. same if user picks english in first place. since there more french users, default language on home page.
the content in folder prefixes: fr_language.php , en_language.php
links fr or en
<a href="?lang=fr">français</a> <a href="?lang=en">english</a>
and navigation
<ul> <li><a href="index.php"><?php echo $lang['home']; ?></a></li> <li><a href="services.php"><?php echo $lang['services']; ?></a></li> <li><a href="about.php"><?php echo $lang['aboutus']; ?></a></li> <li><a href="contact.php"><?php echo $lang['contact']; ?></a></li> </ul>
thanks help!
edit:
ok great, it's working! in "nav.php" include, i wrote this. perhaps it's possible cleaner version, haha! ideas? again!
consider using following approach/method:
if(isset($_get['lang']) && $_get['lang'] == "fr"){ // } else { // else }
you should made aware of (xss) cross-site scripting.
here few links read on:
- http://en.wikipedia.org/wiki/cross-site_scripting
- http://www.sitepoint.com/php-security-cross-site-scripting-attacks-xss/
- http://www.smashingmagazine.com/2011/01/11/keeping-web-users-safe-by-sanitizing-input-data/
you can further research using "xss injection php" keywords in favorite search engine.
Comments
Post a Comment