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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.