Re: register globals on
| From: | Chris | Date: | Tue, 12 Sep 2006 07:24:38 +0000 |
| Subject: | Re: register globals on | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241646@lists.php.net to get a copy of this message | ||
Zbigniew Szalbot wrote:
Hello again, On Tue, 12 Sep 2006, Chris wrote:No real hint about what to use instead, we don't know the code. At a guess he's doing something like: <?php $lang_file = $lang . '.php'; include($lang_file); .... What he should be doing: <?php $default_language = 'en'; $valid_languages = array('en', 'fr'); if (isset($_GET['lang'])) { $lang_chosen = $_GET['lang']; } else { $lang_chosen = $default_language; } if (!in_array($lang_chosen, $valid_languages)) { $lang_chosen = $default_language; } include($lang_chosen . '.php'); .... What that does is checks to see if there is a 'lang=' in the url. If there is, it makes sure it's valid (in this case either 'en' or 'fr'). If it's not set or it's not valid, then it uses the default language ('en'). -- Postgresql & php tutorials http://www.designmagick.com/Thanks a lot! Any hint what to use instead? I mean I will tell him to re-think things but with techi guys I would simply feel better saying we need to rework the website using...???I thought I would ask your opinion before we make any decision. Is it really so that without register globals, such things as displaying information from databases based on the initial choice of languages is not an option? I am not a programmer so I just need general guidance.Complete rubbish. He's being lazy.