I'm trying to program a small system on my site revolving around the number count generated by a Perl script and output into a single-numbered text file. I'm using cookies; throughout the site (which is in PHP; the Perl part is not important in this matter), the computer compares the value in the cookie and the value on the text file to decide what to show:
<?php
$record = $HTTP_COOKIE_VARS["record"];
$file = "http://vcw.vali-ent.com/roleplays/count.txt";
$count = fopen($file, 'r');
$data = fread($count, 5);
fclose($count);
if (isset($_COOKIE['record'])){
if ($record > $data){
print("NEW!");
} else {
print("No New");
}
} else {
print("Not Set");
}
?>
My plan is to have the number update on a certain page using an iframe. And that the iframe only contains this snipet of code:
<?php
$file = "http://vcw.vali-ent.com/roleplays/count.txt";
$count = fopen($file, 'r');
$data = fread($count, 5);
fclose($count);
setcookie("record",$data,time()+604800);
?>
The only problem is that the second portion of code doesn't work. Does anyone know what I'm doing wrong?