Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Something Wrong??

    Hi guys

    my browser returns the message found at the url below.
    http://www.gameygro.com/play/space.php?1

    I am using the following php code

    PHP Code:
    <?php
    /* Count How Many Times A Space Game Has Been Played */
    $temp file('/usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/' 'spacetotal.txt');
    $fp=fopen($temp ,"r");
    $count=fgets($fp,1024);
    fclose($fp);
    $fw fopen($temp ,"w");
    $cnew $count+1;
    $countnew fputs($fw,$count+1);
    echo 
    "$cnew";
    fclose($fw); 

    /* Send To Correct Page */
    header ("Location: /play/space/$QUERY_STRING.php");
    ?>
    Whats worong??

    Pete

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this...

    PHP Code:
    <?php
    /* Count How Many Times A Space Game Has Been Played */
    $temp 'usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/spacetotal.txt';

    $fp=fopen($temp ,"r");
    while(!
    feof($fp))
    {
    $count=fgets($fpfilesize($temp));
    }
    fclose($fp);
    $fw fopen($temp ,"w");
    $cnew $count+1;
    $countnew fputs($fw,$cnew);

    fclose($fw); 

    /* Send To Correct Page */
    header ("Location: /play/space/$QUERY_STRING.php");
    ?>
    Right, that should work. Remember, headers can only be sent BEFORE any page content. You tried to echo $cnew, writing content to the page, so the header fails.

    If it doesnt work, post back.


  •  

    Posting Permissions

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