Changed servers; odd problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • calzephyr@gmail.com

    Changed servers; odd problem

    Hi group,

    I recently switched hosts, and now my main controller page for my
    website isn't working correctly anymore. It worked fine on the old
    host. The new host uses 5.0.4 whereas the old host used PHP 4.*.

    I used switch statements to swap out text and graphics depending on the
    parameters defined in the URL. Now it looks like the controller page is
    ignoring them.

    Here's the page:



    When you click "Work" or "Links" you should get different content as
    well as different images, but it seems to be defaulting to the "About"
    page all the time.

    Here is a sample of the switch statement I used:

    <?php
    switch ($S)
    {
    case 0:
    echo "<img src=pix/about.gif border=0 /><br />";
    break;
    case 1:
    echo "<img src=pix/work.gif width=64 height=33 alt=Work border=0
    /><br />";
    break;
    case 2:
    echo "<img src=pix/paintings.gif width=99 height=35 alt=Paintings
    border=0 /><br />";
    break;
    case 3:
    echo "<img src=pix/photos.gif width=74 height=31 alt=Photos border=0
    /><br />";
    break;
    case 4:
    echo "<img src=pix/photos.gif width=105 height=34 alt=Photos border=0
    /><br />";
    break;
    case 5:
    echo "<img src=pix/links.gif width=53 height=31 alt=Links border=0
    /><br />";
    break;
    case 6:
    echo "<img src=pix/thisnthat.gif width=133 height=32 alt=This N That
    border=0 /><br />";
    break;
    case 7:
    echo "<img src=pix/shop.gif width=56 height=37 alt=Shop border=0
    /><br />";
    break;
    default:
    echo "No number between 1 and 3";
    }
    ?>

    Has any syntax changed from 4 to 5? I'm something of a PHP noodler, so
    I'm by no means an expert. Any suggestions would be appreciated.

    Thanks,
    Christine

  • Gordon Burditt

    #2
    Re: Changed servers; odd problem

    >I recently switched hosts, and now my main controller page for my
    >website isn't working correctly anymore. It worked fine on the old
    >host. The new host uses 5.0.4 whereas the old host used PHP 4.*.
    >
    >I used switch statements to swap out text and graphics depending on the
    >parameters defined in the URL. Now it looks like the controller page is
    >ignoring them.
    >
    >Here's the page:
    >
    >http://www.purple-pony.com/main.php?ID=0&S=0
    >
    >When you click "Work" or "Links" you should get different content as
    >well as different images, but it seems to be defaulting to the "About"
    >page all the time.
    >
    >Here is a sample of the switch statement I used:
    >
    ><?php
    >switch ($S)
    Register-globals is evil. Newer versions default it off, and
    hopefully they will get rid of it entirely.

    Use $_GET['S'], not $S.


    Comment

    • ruibalp@gmail.com

      #3
      Re: Changed servers; odd problem

      insert either

      $S = $_GET['S'];
      $ID = $_GET['ID'];

      or

      extract($_GET);

      at the top of the script; or do what mister Burditt proposes.

      Comment

      • calzephyr@gmail.com

        #4
        Re: Changed servers; odd problem

        Thank you :-) I added in

        switch ($_GET["S"])

        and it works perfectly now :-)

        Best,
        Christine

        Comment

        • calzephyr@gmail.com

          #5
          Re: Changed servers; odd problem

          Thanks so much Gordon. I'm glad the fix was so simple! I added in

          switch ($_GET["S"])

          at the top and it works! Thanks again.

          Best,
          Christine

          Comment

          Working...