checking args - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

checking args

daniel rojasdaniel rojas Posts: 70Member
hey!

can anyone write me a function that does the following:

- i open the page "write.php?write=hey"
- the function checks if the argument "write" exists
- if it exists, it reads the value
- it writes the value (in ths case, "hey") on the page

just a little function like this:
function GetArg(Name)
{
if AgrumentDoesntExist
return ""
else
return TheArgumentValue
}

Comments

  • DarQDarQ Posts: 1,625Member
    with register_globals OFF in php.ini;

    if (isset($_GET['write'])) {
    echo $_GET['write'];
    }

    too simple;-)
    : hey!
    :
    : can anyone write me a function that does the following:
    :
    : - i open the page "write.php?write=hey"
    : - the function checks if the argument "write" exists
    : - if it exists, it reads the value
    : - it writes the value (in ths case, "hey") on the page
    :
    : just a little function like this:
    : function GetArg(Name)
    : {
    : if AgrumentDoesntExist
    : return ""
    : else
    : return TheArgumentValue
    : }
    :
    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://space.servehttp.com (ssh,ftp,http,smtp,jabber etc etc)

  • daniel rojasdaniel rojas Posts: 70Member
    hey!

    well, that's simple! :D
    but what happens if i turn register_globals ON? i tested it offline and it worked the same way...
  • DarQDarQ Posts: 1,625Member
    register_globals doesnt change its behaviour if offline or not. Almost nothing does except for a few variables ;-)

    anyway.. please keep register globals turned OFF. for the exact reasons you should browse php.net. im too lazy to search that url for you right now :-D
    keeping it off makes sure your scripts will survive the next php upgrade. because they don't like it either.

    it has all comes down to a security hazard made by the programmer. but if the coder codes his code correct, it won't be such a problem.

    : hey!
    :
    : well, that's simple! :D
    : but what happens if i turn register_globals ON? i tested it offline and it worked the same way...
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://space.servehttp.com (ssh,ftp,http,smtp,jabber etc etc)

Sign In or Register to comment.