Re: Question about Cookies
| From: | Robert V. Zwink | Date: | Fri, 05 May 2000 14:53:16 +0000 |
| Subject: | Re: Question about Cookies | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-18461@lists.php.net to get a copy of this message | ||
You should probably include the error message in your posting? Do you
mean that you can't get the cookie to set, or that you are getting
unexpected results?
You will want to output text after the cookie is set, so move the
"<head><meta. . " line to the bottom of your script.
Robert Zwink
Andrew Phillips wrote:
>
> Hello,
> I have been trying to get a cookie to be created and I just can't get it to
> work. If any one could help me out
> by email or ICQ me (72178276) with any suggestions. I have attached the
> code, if you could help me I could possibly
> be a good person to bounce code ideas off of on ICQ.
>
> -Andrew Phillips
>
> Code:
>
> <head><meta http-equiv="Refresh" content="5;
> URL=infochange.php"><? //
> Variable Listing for ease of coding
> // $Banker_Last, $Banker_MI, $Banker_First, $ORC,
> //$Banker_Location, $Internal_Mail_Code,
> // $Banker_Area, $Banker_Zone, $Banker_Loc
> // These are the Phone Information
> // $Banker_Fax_Area, $Banker_Fax_Zone, $Banker_Fax_Loc,
> // $Banker_Email Fax Information
>
> // Set the Array for Encoding
>
> $Cookie_Array = array( "$Banker_Last", "$Banker_MI",
> "$Banker_First",
> "$ORC", "$Banker_Location", "$Internal_Mail_Code",
> "$Banker_Area", "$Banker_Zone", "$Banker_Loc",
> "$Banker_Fax_Area", "$Banker_Fax_Zone",
> "$Banker_Fax_Loc",
> "$Banker_Email" );
>
> // Now Serialize the Array
>
> $Serialized_Array = serialize($Cookie_Array);
>
> // Getting the current date
> $hour = date("H:i:s");
> $year = date("y");
> $year + 900; // Adding 900 years to the current year
> $day = date("d-M-") . $year;
> $day_off_the_week = date("l");
>
> $validation = $day_off_the_week . ", " . $day . " " . $hour . "
> GMT";
>
> // Set a cookie's value.
> header("Set-Cookie: EFEapp=$Serialized_Array; expires=$validation");
>
> ?>
> </head>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net