Version: 0.5

Type: Sample Code (HOWTO)

Category: Other

License: GNU General Public License

Description: This code Pulls information from a Cookie that was set by ASP with multiple values. The cookie name is Employee. HireDate, Security, Username, Enter, LastName, and FirstName are all variables stored in the cookie. cookies are set and handled differently by ASP so I wrote this to help people that use both languages be able to pull the info. ASP seperates the variables and their values using "&" so I explode the string into an array and split it at the "&". I then had to explode each of those array values at the "=" to get the raw values of each variable in the cookie. That is it, that is all I did. I figure someone will figure out how to improve this so I am making it a 0.5 for now =)



<?php 
//This code Pulls information from a Cookie that was set by ASP with multiple values.
//The cookie name is Employee. HireDate, Security, Username, Enter, LastName, and FirstName
//are all variables stored in the cookie.
//cookies are set and handled differently by ASP so I wrote this to help people that use both languages be able
//to pull the info.
//ASP seperates the variables and their values using "&" so I explode the string into an array and split it at the "&".
//I then had to explode each of those array values at the "=" to get the raw values of each variable in the cookie.
//That is it, that is all I did. 
//Author: Jason Nelms
//Site: http://www.damnittohell.com
//Email: jason@damnittohell.com

$Cookie = explode("&", $Employee, 6);
$HireDate1 = explode("=", $Cookie[0], 12);
$Security1 = explode("=", $Cookie[1], 12);
$username1 = explode("=", $Cookie[2], 12);
$Enter1 = explode("=", $Cookie[3], 12);
$lastname1 = explode("=", $Cookie[4], 12);
$firstname1 = explode("=", $Cookie[5], 12);

$hiredate = $HireDate1[1];
$security = $Security1[1];
$username = $username1[1];
$enter = $Enter1[1];
$lastname = $lastname1[1];
$firstname = $firstname1[1];
?>