PHP SSI suddenly stop working

Discussion in 'PHP' started by MilesB, Aug 22, 2007.

  1. #1
    www.animeomnitude.com
    If you click any link in the side bar it displays the same content as the homepage. Before it used to include the file that I linked to into the content part of the page but now it has stopped that.

    Here is my php nav/incude code in the index.php

    <?php
    /*
       Inklude v2.3
       By:        Kage (Alex)
       E-Mail:    Kage@DBZSC.com
       URL:       http://www.dbzsc.com/?dbzsc=phpinclude
       Copyright: © 2002-2005 Kage (Alex), All Rights Reserved.
    */
    
    // Settings:
    
    $abspath = ".";
    // Set the above to your absolute path.  _DO NOT_ include a trailing slash.
    // You can leave it as "." and it should work just fine.
    
    $extension = "php";
    // The extention of included files.  It is STRONGLY recommended you use a unique extension
    // that will be used by NO other files except include files.  _DO NOT_ include a dot.
    // It is also STRONGLY recommended that you absolutely DO NOT use PHP as include extentions.
    
    $defaultfile = "news.php";
    // This is the default file that is called should no query be provided.  You MUST include the
    // extension, however, _DO NO_ include the absolute path, that's already added by what you
    // provided in $abspath.
    
    $errorfile = "error.php";
    // This is the error file included should someone provide a nonexistant query.  You MUST
    // include the extension, however, _DO NO_ include the absolute path, that's already added
    // by what you provided in $abspath.
    
    $query = "page";
    // This is the query used when calling include pages.
    // Ex: main.php?id=blah -- id is the query
    
    // End User Serviceable Parts
    
    clearstatcache();
    $includestring = "";
    $mainpage = urldecode($$query);
    $mainstring = $abspath."/".$mainpage.".".$extension;
    if (!$mainpage) {
      $includestring = $abspath."/".$defaultfile;
    } elseif (ereg("\.\.", $mainpage) || substr($mainpage,0,2) == "./" || substr($mainpage,0,3) == "../") {
      die("Screw off.");
    } else {
      if (file_exists($mainstring) && is_file($mainstring)) {
       $includestring = $mainstring;
      } else {
       $includestring = $abspath."/".$errorfile;
      }
    }
    @include($includestring);
    // End Of Inklude
    ?> 
    PHP:



    New:
    <?php
    /*
       Inklude v2.3
       By:        Kage (Alex)
       E-Mail:    Kage@DBZSC.com
       URL:       http://www.dbzsc.com/?dbzsc=phpinclude
       Copyright: © 2002-2005 Kage (Alex), All Rights Reserved.
    */
    
    // Settings:
    
    $abspath = "/home/animeomn/public_html";
    // Set the above to your absolute path.  _DO NOT_ include a trailing slash.
    // You can leave it as "." and it should work just fine.
    
    $extension = "php";
    // The extention of included files.  It is STRONGLY recommended you use a unique extension
    // that will be used by NO other files except include files.  _DO NOT_ include a dot.
    // It is also STRONGLY recommended that you absolutely DO NOT use PHP as include extentions.
    
    $defaultfile = "news.php";
    // This is the default file that is called should no query be provided.  You MUST include the
    // extension, however, _DO NO_ include the absolute path, that's already added by what you
    // provided in $abspath.
    
    $errorfile = "404.shtml";
    // This is the error file included should someone provide a nonexistant query.  You MUST
    // include the extension, however, _DO NO_ include the absolute path, that's already added
    // by what you provided in $abspath.
    
    $query = "page";
    // This is the query used when calling include pages.
    // Ex: main.php?id=blah -- id is the query
    
    // End User Serviceable Parts
    
    clearstatcache();
    $includestring = "";
    $mainpage = urldecode($query);
    $mainstring = $abspath."/".$mainpage.".".$extension;
    if (!$mainpage) {
      $includestring = $abspath."/".$defaultfile;
    } elseif (ereg("\.\.", $mainpage) || substr($mainpage,0,2) == "./" || substr($mainpage,0,3) == "../") {
      die("Screw off.");
    } else {
      if (file_exists($mainstring) && is_file($mainstring)) {
       $includestring = $mainstring;
      } else {
       $includestring = $abspath."/".$errorfile;
      }
    }
    @include($includestring);
    // End Of Inklude
    ?> 
    PHP:
     
    MilesB, Aug 22, 2007 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try changining
    
    $query = "page";
    
    Code (markup):
    to
    
    $query = $_GET['page'];
    
    Code (markup):
     
    powerspike, Aug 22, 2007 IP
    MilesB likes this.
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    ^^ If you do that, make sure to remove one of the dollar signs here:
    
    $mainpage = urldecode($$query);
    
    PHP:
     
    nico_swd, Aug 22, 2007 IP
    MilesB likes this.
  4. MilesB

    MilesB Well-Known Member

    Messages:
    1,813
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    180
    #4
    That worked! I've spent our trying to fix!!!!!! Reps!(both of you)

     
    MilesB, Aug 22, 2007 IP
  5. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    that was fixed in the new code block he pasted.

    looks like his host turned off register globals..
     
    powerspike, Aug 22, 2007 IP