good code, bad code, magic code

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

    good code, bad code, magic code

    i've discovered (on my server) that it doesn't seem to be necessary to
    call data from a form via $_POST, or to retrieve cookies via $_COOKIE,
    and other such things; they are available by name alone. however, i've
    heard that just because you CAN do something, doesn't mean you SHOULD.
    my question: is this considered bad practice?

    also, when submitting a file via <input name="file" type="file" /> i
    find that not only does $file get set, but $file_name and others also
    "magically" get set... I guess I just find that odd coming from C++
    where nothing seems to do work for you... quite nice and handy though :)

  • Gordon Burditt

    #2
    Re: good code, bad code, magic code

    >i've discovered (on my server) that it doesn't seem to be necessary to[color=blue]
    >call data from a form via $_POST, or to retrieve cookies via $_COOKIE,
    >and other such things; they are available by name alone. however, i've[/color]

    register_global s is a security problem. Don't write code that
    depends on it.
    [color=blue]
    >heard that just because you CAN do something, doesn't mean you SHOULD.
    >my question: is this considered bad practice?[/color]

    Yes. And you'll probably find some hosting companies that
    WILL NOT turn on register_global s for any price.

    Gordon L. Burditt

    Comment

    • Mark

      #3
      Re: good code, bad code, magic code

      great! thanks.
      that's all I wanted to know.

      Comment

      Working...