globals & session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ike

    globals & session

    if you are programming a php-page and you use the following, what will
    be the result?

    <form action=test.php method=post>
    name: <input type=text name=naam><br>
    id: <input type=text name=userid><br >
    </form>

    in the page test.php:

    $userid = $_SESSION['userid'];

    this session var was set previously

    will $userid be written with the 5 from the post or will it be written
    with the $_SESSION['userid']

    is it still secure to use this variable more than once?

    on the server i use the globals can't be turned of

    thx on advance Ike
  • Tony Marston

    #2
    Re: globals &amp; session

    Do you mean register_global s? Can't you turn it off with an .htaccess file?

    If register_global s is ON then the contents of the GET/POST arrays will be
    available to your script the minute it fires up and before you execute the
    first line of code. If you then change a variable then that variable is
    changed.

    You can use a variable more than once, but it will only contain the last
    value written to it.

    --
    Tony Marston

    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL




    "Ike" <devolderike@ya hoo.com> wrote in message
    news:10c04697.0 409290107.70da0 77d@posting.goo gle.com...[color=blue]
    > if you are programming a php-page and you use the following, what will
    > be the result?
    >
    > <form action=test.php method=post>
    > name: <input type=text name=naam><br>
    > id: <input type=text name=userid><br >
    > </form>
    >
    > in the page test.php:
    >
    > $userid = $_SESSION['userid'];
    >
    > this session var was set previously
    >
    > will $userid be written with the 5 from the post or will it be written
    > with the $_SESSION['userid']
    >
    > is it still secure to use this variable more than once?
    >
    > on the server i use the globals can't be turned of
    >
    > thx on advance Ike[/color]


    Comment

    • Ike

      #3
      Re: globals &amp; session

      yes indeed it is register_global s is on

      so that means if register_global s is on that i better do not use the
      same variable twice.

      i don't know how to use the .htaccess file

      and can you change settings with a config file from apache in you php
      settings?

      "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message news:<cje272$q0 h$1$8302bc10@ne ws.demon.co.uk> ...[color=blue]
      > Do you mean register_global s? Can't you turn it off with an .htaccess file?
      >
      > If register_global s is ON then the contents of the GET/POST arrays will be
      > available to your script the minute it fires up and before you execute the
      > first line of code. If you then change a variable then that variable is
      > changed.
      >
      > You can use a variable more than once, but it will only contain the last
      > value written to it.
      >
      > --
      > Tony Marston
      >
      > http://www.tonymarston.net[/color]

      Comment

      • Justin Koivisto

        #4
        Re: globals &amp; session

        Ike wrote:[color=blue]
        > yes indeed it is register_global s is on
        >
        > so that means if register_global s is on that i better do not use the
        > same variable twice.
        >
        > i don't know how to use the .htaccess file[/color]

        create a file in your document root named ".htaccess" with the following:

        php_flag register_global s 0

        Then do a phpinfo() call and see what it says for the "local" value.
        [color=blue]
        > and can you change settings with a config file from apache in you php
        > settings?[/color]



        Whenever I am dealing with a server that has register_global s = On, I
        simply avoid using variable names that match up with GET or POST var
        names...

        --
        Justin Koivisto - spam@koivi.com

        Comment

        • Ike

          #5
          Re: globals &amp; session

          Thx to you people, it was a real good help for me

          my problems are solved

          Justin Koivisto <spam@koivi.com > wrote in message news:<xKB6d.309 $AU4.14859@news 7.onvoy.net>...[color=blue]
          >
          > create a file in your document root named ".htaccess" with the following:
          >
          > php_flag register_global s 0
          >
          > Then do a phpinfo() call and see what it says for the "local" value.
          >[color=green]
          > > and can you change settings with a config file from apache in you php
          > > settings?[/color]
          >
          > http://us2.php.net/manual/en/configu...changes.apache
          >
          > Whenever I am dealing with a server that has register_global s = On, I
          > simply avoid using variable names that match up with GET or POST var
          > names...[/color]

          Comment

          Working...