Web Analytics Made Easy -
StatCounter Making a variable unchangeable - CodingForum

Announcement

Collapse
No announcement yet.

Making a variable unchangeable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making a variable unchangeable

    This may sound like a really stupid question, but is there anyway of creating a php variable, that can't be changed by simply typing in mypage.php?var=2. So basically a variable that is always a fixed amount?
    Thanks,
    ttttt
    http://openoffice.org/- Microsoft Office without the Microsoft.
    [home page][forum]
    Versatile, free software

  • #2
    Yes, these are called constants.
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

    Comment


    • #3
      http://us2.php.net/define
      eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

      Comment


      • #4
        Seems to me like you're asking a couple different things.

        http://mysite.com/?var=2 will affect scripts that have "register_globals on" in php.ini.

        Defines are very handy - but for an entirely different reason - although they do acheive the result of being unchangable, I'm not sure this is what you're concerned with.

        Look into disabling register_globals and defines - you should be able to find your answer.
        Active PHP/MySQL application developer available for immediate work.
        syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

        Comment

        Working...
        X