Results 1 to 7 of 7

Thread: Query string problems

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Query string problems

    This is my code:
    PHP Code:
    <?
    if (!isset($file))
    {
        $contents = "You did not specify a file";
    }
    else
    {
        $pFile = fopen($file, "r");
        $contents = fread($pFile, filesize($file));
        fclose($pFile);
    }
    echo $contents;
    ?>
    The problem is, no matter what I put in, it always prints the error message. What am I doing wrong?
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    hmm.. if you are getting the $file variable from a querystring or a form POST submission, be sure that register_globals = on in the php.ini file. if not, you can use the
    $_GET["file"] or $_POST["file"]
    variables to get the value.

    hope this helps.

  3. #3
    Originally posted by Kagey
    hmm.. if you are getting the $file variable from a querystring or a form POST submission, be sure that register_globals = on in the php.ini file. if not, you can use the
    $_GET["file"] or $_POST["file"]
    variables to get the value.

    hope this helps.
    There's also:
    PHP Code:
    $HTTP_POST_VARS['file'
    Unless they're one in the same.

  4. #4
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294

    Post

    that works too...

  5. #5

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    K, that works fine. Thanks
    Alcohol & calculus don't mix.
    Never drink & derive.

  6. #6
    scoutt
    Guest
    Originally posted by filburt1


    There's also:
    PHP Code:
    $HTTP_POST_VARS['file'
    Unless they're one in the same.
    can you say deprecated...

  7. #7
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    i tried to insinuate it...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width