PHP 5 upgrade breaks $do?

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

    PHP 5 upgrade breaks $do?

    A friend of mine has a set of pages at:



    that use PHP; recently the server company upgraded to PHP 5, which
    breaks the site; clicking on the Crew, Navigation etc links at the top
    left of the above page just brings you back to the main page.

    The PHP code is in a file called index.php, it's 200 lines which is
    sometimes considered excessive for posting on Usenet, but I can post it
    if need be; the relevant code appears to be:

    if($do == "Hideout"){ include("home.h tml"); }
    elseif($do == "Crew") {include("chara cters.htm"); }
    elseif($do == "Navigation ") {include("story .htm"); }

    etc, and it seems that the variable $do isn't being set correctly with
    the new version. Anyone have any idea what might be wrong?

    (I myself know not one line of PHP, and the author of the site is by his
    own admission no expert on it, so quite possibly we're not asking the
    right questions; please let me know if we're going about this the wrong
    way. I tried Google, but it doesn't appear to accept keywords like $do
    that contain punctuation.)

    Thanks,

    --
    "Always look on the bright side of life."
    To reply by email, replace no.spam with my last name.
  • Chris Hope

    #2
    Re: PHP 5 upgrade breaks $do?

    Russell Wallace wrote:
    [color=blue]
    > A friend of mine has a set of pages at:
    >
    > http://ipa.buffalostate.edu/~skablah/7thSea/?do=Hideout
    >
    > that use PHP; recently the server company upgraded to PHP 5, which
    > breaks the site; clicking on the Crew, Navigation etc links at the top
    > left of the above page just brings you back to the main page.
    >
    > The PHP code is in a file called index.php, it's 200 lines which is
    > sometimes considered excessive for posting on Usenet, but I can post
    > it if need be; the relevant code appears to be:
    >
    > if($do == "Hideout"){ include("home.h tml"); }
    > elseif($do == "Crew") {include("chara cters.htm"); }
    > elseif($do == "Navigation ") {include("story .htm"); }
    >
    > etc, and it seems that the variable $do isn't being set correctly with
    > the new version. Anyone have any idea what might be wrong?
    >
    > (I myself know not one line of PHP, and the author of the site is by
    > his own admission no expert on it, so quite possibly we're not asking
    > the right questions; please let me know if we're going about this the
    > wrong way. I tried Google, but it doesn't appear to accept keywords
    > like $do that contain punctuation.)[/color]

    Sounds like register_global s is set to off (which has been the default
    since 4.3 IIRC).

    You should be accessing external variables like so:
    $_GET['do']
    $_POST['do']
    $_COOKIE['do']

    using whichever super global is appropriate.

    If you are not able to do this (eg big project with hundreds of pages of
    code etc) then you'd need to set register_global s on for that site.

    --
    Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

    Comment

    • Russell Wallace

      #3
      Re: PHP 5 upgrade breaks $do?

      Chris Hope wrote:[color=blue]
      > Sounds like register_global s is set to off (which has been the default
      > since 4.3 IIRC).
      >
      > You should be accessing external variables like so:
      > $_GET['do']
      > $_POST['do']
      > $_COOKIE['do']
      >
      > using whichever super global is appropriate.[/color]

      That worked, thanks!

      --
      "Always look on the bright side of life."
      To reply by email, replace no.spam with my last name.

      Comment

      Working...