Jump to content

[SOLVED] What am I doing wrong?


060_VCW_606

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/154497-solved-what-am-i-doing-wrong/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.