|
Posted by Jerim79 on 02/07/07 20:04
On Feb 7, 1:30 pm, VS <v...@nospam.blueyonder.invalid> wrote:
> Jerim79 wrote:
> > Lets say I create a file on my computer called "printer". Inside that
> > file I manually type something like: printer=A. How would I send that
> >cookieto the PHP form?
>
> Perhaps something like (untested) :
>
> <?php
> $Now = time();
> $Year=60*60*24*365;
> if( !isset($_COOKIE['printer']) ){
> if( GetPrinter() ){
> setcookie("printer",$Printer,$Now+$Year);
> }}else{
>
> $Printer = $_COOKIE['printer']}
>
> Function GetPrinter
> {
> global $Printer;
> $Printer = "";
> $FL = @fopen("/xxx/printer", 'r');
> if( $FL ) {
> $buffer = fgets($FL);
> list($key, $Value) = split("=",$buffer);
> if( $key = "printer" ){
> $Printer = $Value;
>
> break;
> }
> }
> fclose($FL);
> return ($Printer <> "");}
>
> ?>
>
> --
> VS
I don't know how to make this any clearer. I never ever ever ever ever
want the PHP code to create any type of cookie, ever. I just want it
to read the cookie, which I will create manually and place it in a
directory where the form can access it. Just as in any other language,
you can open a file outside the program and read its contents. That is
all I am trying to accomplish here. Think of a C++ program that opens
a file name text.txt. The program doesn't have to create the file
first to open it and read it, the file just simply has to exist at the
specified location.
Navigation:
[Reply to this message]
|