Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my script crashes explorer =/

Status
Not open for further replies.

iostream71

Programmer
Mar 13, 2002
229
US
it works fine until i close the browser, then open a new instance. it causes my ie6 to think it's offline, displaying the work offline/try again box. works fine for netscape with no crashes

basically, i have a flash animation that calls this script, and it writes the count to a text file which flash reads

<?php
session_start();
//counter file
$filename = &quot;counter.dat&quot;;
$fp = fopen ($filename, &quot;r&quot;);
$count = fread ($fp, filesize($filename));
fclose ($fp);
//user hasn't visited
if (!isset($HTTP_SESSION_VARS['count'])) {
//junk variable to determine visit
$HTTP_SESSION_VARS['count'] = 1;
$count++;
$fp = fopen( $filename,&quot;w&quot;);
fwrite($fp, $count, filesize($filename));
fclose( $fp );
}
//write for flash
print &quot;&counterValue=&quot;;
print $count;
?>
 
used this one, sorry

<?php
session_start();
//counter file
$filename = &quot;counter.dat&quot;;
$fp = fopen ($filename, &quot;r&quot;);
$hits = fread ($fp, filesize($filename));
fclose ($fp);
//user hasn't visited
if (!isset($HTTP_SESSION_VARS['count'])) {
//junk variable to determine visit
$HTTP_SESSION_VARS['count'] = 1;
$hits++;
$fp = fopen( $filename,&quot;w&quot;);
fwrite($fp, $hits, filesize($filename));
fclose( $fp );
}
//write for flash
print &quot;&counterValue=&quot;;
print $hits;
?>

 
ok, i found out my explorer was corrupt, which was causing the crash problem

my other problem is, the counter resets to 1 after 10 hits every time
 
What is the lifetime of sessions on your system? ______________________________________________________________________
Perfection in engineering does not happen when there is nothing more to add.
Rather it happens when there is nothing more to take away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top