1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What am I missing here? (!$op) error

Discussion in 'PHP' started by Decipher442, Apr 3, 2009.

  1. #1
    Hi,

    For some reason the home page is displaying but no inner pages are displaying, all I did was transfer it.

    This is the code in index file:
    <?php
    if (!$op) {
    include ("list.php");
    } else {
    if (file_exists("$op.php")) {
    include( "includes/header.inc");
    include( "includes/left_side.inc");
    include ("$op.php");
    include( "includes/right_side.inc");
    include( "includes/footer.inc");
    } else {
    include ("list.php");
    }
    }
    ?>
    PHP:
    Am I suppost to have special server requirements to run this (!$op) command on the site?


    This is what I have in my .htaccess file..
    <IfModule mod_php4.c>
    
    	php_flag register_globals on
    
    </IfModule>
    PHP:
    What am I missing here?
    Do you know why my site isnt pulling up?


    --Thanks!
     
    Decipher442, Apr 3, 2009 IP
    Barti1987 likes this.
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Well... where is $op defined? The variable, obviously meant to be a filename, must be defined somewhere.

    It also seems that you don't have the files placed in the correct directories - or that the directory structure on the new server is different from that of the former one - 'cause when one click on different links, you get lots of "missing include" errors.

    Something is wrong, but it's got nothing to do directly with the code you've shown us - there is something wrong with either the variables defines, the values of the defined variables, or the structure of the files/directories.
     
    PoPSiCLe, Apr 3, 2009 IP
  3. Decipher442

    Decipher442 Well-Known Member

    Messages:
    1,299
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I place the directory structure just as it was on the previous server.. and the site worked just fine on the other server.

    I think I have to add a server requirement through .htaccess or php.ini file, I just don't know what..

    Here is the OP file..

    
    <?PHP
      define ("REALPATH", '/home/massivet/');
    
    
      if (strcmp ($HTTP_USER_AGENT, "Active Worlds Browser"))
        exit();
    
    
      $IsZip = 0;
    
      if (! empty ($DOCUMENT_ROOT))
        $DocRoot = $DOCUMENT_ROOT;
      else
        $DocRoot = '';
    
      if ($Content = strrchr ($QUERY_STRING, '.'))
      {
        if (stristr ($Content, '.zip'))
        {
          $IsZip = 1;
          Header ('Content-Type: application/zip');
        }
        else
          Header ('Content-type: image/jpeg');
      }
    
    
      if (! ($Filename = strrchr ($QUERY_STRING, '/')))
        $Filename = strrchr ($QUERY_STRING, '\\');
      if ($Filename)
      {
        $Filename = substr ($Filename, 1);
        Header( 'Content-Disposition: attachment; filename='.$Filename );
      }
    
      if ($Filename[0] == '.')
        exit();
    
      $Filename = $DocRoot.REALPATH.$QUERY_STRING;
      if (! file_exists ($DocRoot.REALPATH.$QUERY_STRING))
        exit();
    
      $arr = split ("[\\/]", $Filename);
    
      for ($i=0; $i<sizeof($arr); $i++)
        if (! strcmp ($arr[$i], '..'))
        {
          array_splice ($arr, $i-1, 2);
          $i=0;
        }
      $Filename = $arr[0];
      for ($i=1; $i<sizeof($arr); $i++)
        $Filename .= '/'.$arr[$i];
    
      if (strncmp ($DocRoot.REALPATH, $Filename, strlen($DocRoot.REALPATH)))
        exit();
    
      $Filesize = filesize ($Filename);
      Header ('Content-Length: '.$Filesize);
    
      if ($fIn = fopen ($Filename, 'rb'))
        fpassthru ($fIn);
    ?>
    
    PHP:
     
    Decipher442, Apr 3, 2009 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Okay - and the new server has a document root path of "/home/massivet/"? Not something else, like "/www/", "/home/public_html/" or something similar?
     
    PoPSiCLe, Apr 3, 2009 IP
    Decipher442 likes this.
  5. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Maybe php_flag register_globals on isn't working.

    Create a new file, and do echo $test (pass it via the url). If it doesn't work, then you have to convert $op to:

    $op = $_GET['op'];

    Peace,
     
    Barti1987, Apr 3, 2009 IP
    Decipher442 likes this.
  6. Decipher442

    Decipher442 Well-Known Member

    Messages:
    1,299
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Hey thanks... got it figured out.
     
    Decipher442, Apr 3, 2009 IP