Entry
How can I save a variable to a file on the client (without cookies) and retrieve its value later?
How can I save a value to a file on the server?
May 15th, 2000 16:20
Greg Billock, George Federuik, Nathan Wallace,
There is no way to access client side filesystems without cookies (thank
goodness!) Cookies provide a very restricted way to store information on
the user's machine. (See cookie() in the PHP manual.)
To write a variable to a file on the server, you can simply do
$f = fopen("file","w");
fwrite($f,$variable);
fclose($f);
and then
$f = fopen("file","r");
$variable = fgets($r);
fclose($f);