Page 1 of 1

passed vars (php) and non-English forum

PostPosted: 25. December 2010 01:13
by ElfN
I have two problems. The first is a minor irritation and I'm sure I did it to myself. <sigh> When I sign in, I end up on a non-english version of the forum. Don't ask me how I managed signing myself up to something in a language that vaguely resembles German, but there you go, that's what I've managed to do. Any idea on how to redirect my redirect to the English version?

Second, I'm having trouble with passed vars. It's the Slippery Critters thing again . . . and before you start yelling about my coding, it works fine online (http://slipperycritters.com/index.php?inc=3). It doesn't work fine in the integrated browser in my editor, nor does it work fine when I go directly to the local file (http://localhost/SlipperyCritters/index.php?inc=3) in my main (Firefox) browser.

I test for $inc and as far as the scripting is concerned, the variable has not been set. Is there something in the php.ini or in the my.ini that should be set differently than what is standard? I can set and print_r a multidimensional array, no problem, but when I'm trying to pass a var in the url, the var acts as if it's never been set. Ideas? Directions to look in? Any kind of help at all?

Thanks.

ElfN

Re: passed vars (php) and non-English forum

PostPosted: 25. December 2010 01:50
by Nobbie
register_globals

Re: passed vars (php) and non-English forum

PostPosted: 25. December 2010 10:35
by Altrea
It's a really really bad practice to use register_globals, because it tempt beginner scripter to build security issues in their scripts.
EVERY variable you havend initialized first can be manipulated in the URLvif register_globals is set to on!

If you want to pass variables by URL, use something like this:
Code: Select all
<?php
//e.g. url: http://localhost/SlipperyCritters/index.php?inc=3
if( !empty( $_GET['inc'] ) ) {
    // make a local variable out of the superglobal array key
    $inc = $_GET['inc'];

    // here you should validate and sanitize your variable !!!
    // don't use variables you don't sanitized first !!!
}


So: Every variable you pass by URL can be find in the superglobal $_GET Array.

Re: passed vars (php) and non-English forum

PostPosted: 25. December 2010 15:16
by ElfN
register_globals is the answer I needed.

Any thoughts on why I go from my login screen to a non-English forum?

Re: passed vars (php) and non-English forum

PostPosted: 26. December 2010 16:09
by JonB
Please tell is how in the world we should know this answer, when you have not mentioned the script name?

Wait, I read your last reply, it has all the info I need

:shock:





ysf