Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.