...

View Full Version : Something Wrong??



ygrouk
04-13-2003, 10:26 PM
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
/* 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

missing-score
04-13-2003, 11:23 PM
Try this...



<?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($fp, filesize($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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum