Superglobals and normal variables

Discussion in 'PHP' started by rafke, Oct 30, 2006.

  1. #1
    Hi,
    I have a script and it is using $username instead of $_POST['username']
    Now, it doesn't work.
    What can I do to make it work?(Except edit the whole script manually)
    Already thanks,
    Raf
     
    rafke, Oct 30, 2006 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Set register_globals to 'on' in your php.ini file or .htaccess file.

    But before doing so, please, for your own sake, do a little Googling to understand the security issues in doing what you're doing...
     
    TwistMyArm, Oct 30, 2006 IP
  3. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #3
    It seems register_globals is off, you need to turn it on.
    But I would recommend to not rely on this variable and use $_GET, $_POST and so on..
     
    wmtips, Oct 30, 2006 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    or use a foreach to loop through $_GET and/or $_POST to change them.

    Peace,
     
    Barti1987, Oct 30, 2006 IP