Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $valid_langs = array('en','fr','de','no');
- if (isset($_GET['lang'])) {
- // verify that it is a valid language choice before attempting to use it
- // you may store an array of possibilities.
- if (in_array($_GET['lang'], $valid_langs)) {
- $language = $_GET['lang'];
- setcookie('lang', $_GET['lang']);
- }
- }
- else if (isset($_COOKIE['lang'])) {
- // also be sure to check that the language is a valid choice in a cookie too.
- if (in_array($_GET['lang'], $valid_langs)) {
- $language = $_COOKIE['lang'];
- }
- }
- $language = substr($_SERVER['HTTP_HOST'],0,2);
Add Comment
Please, Sign In to add comment