Cookie Tools - Version 1.1 -- November 17th, 1998
Author: Patrick Kellum
Copyright: Copyright (c) 1998. Feel free to use as long as this comment is
kept with the script.
Contents:
set_cookie(name, value,
expires, path,
domain, secure) ! Sets a cookie using the "http_equiv" meta tag that is supported by many web browsers.
get_cookie(find) ! Looks for the requested cookie and returns its value if found.
compress_cookie(cookie,
name, value) ! Adds the name/value pair to a global variable that is used as a cookie by set_cookie.
get_compressed_cookie
(cookie, find) ! Looks for the requested cookie in the compressed cookie and returns its value if found. If it's not found, or the cookie isn't set, it returns false.
NOTE:
The insperation for these functions is "HTTP Cookie Library by Matt
Wright", an amazingly easy to use and powerful cookie library for Perl.
The compressed cookie format is based on his library, except only one ':'
is used to seperate name/values.
You can download "HTTP Cookie Library" from Matt Wright' Scripts Archive
at
http://www.worldwidemart.com/scripts/
If you are doing any Perl codding and need cookie support then I highly
recomend "HTTP Cookie Library" library!
Function: set_cookie(name, value, expires, path, domain, secure)
Description: Sets a cookie using the "http_equiv" meta tag that is supported
by many web browsers.
Parameters: name - Name of the cookie to be set. (required)
value - Value to store in this cookie. (required)
expires - Date in time_t format that the cookie should expire.
If set to null, the cookie will expire when the
visitor quites her browser. (optional)
path - Paths that the cookie is valid in, in addition to the
current one. (optional)
domain - Domain that the cookie is valid in. If set to null,
the domain will be the current one. (optional)
secure - If true then only send this cookie over secure (https)
connections. If set to null, the cookie will be
transmitted across any connection. (optional)
Returns: Returns the meta tag for the cookie as a string.
Function: get_cookie(find)
Description: Looks for the requested cookie and returns its value if found.
If it's not found or the cookie isn't set it returns false.
Parameters: find - The name of the cookie to get. If null then all cookies
will be retrived and global variables named after the
name of each cookie will contain the value of that
cookie. For example, a cookie named 'magic' containing
the value 'xyzzy' would set the variable 'g.magic' to
'xyzzy'.
Returns: The value of the cookie, unless the 'find' parameter was null,
in which case it returns true if any cookies were found. If no
cookies were found or the requested cokkie wasn't set then it
returns null.
Function: compress_cookie(cookie, name, value)
Description: Adds the name/value pair to a global variable that is used as a
cookie by set_cookie.
Parameters: cookie - The name of a global variabe to be used as a compressed
cookie. (required)
name - Name of the cookie to be set. (required)
value - Value to store in this cookie. (required)
Returns: Null.
Function: get_compressed_cookie(cookie, find)
Description: Looks for the requested cookie in the compressed cookie and
returns its value if found.
If it's not found, or the cookie isn't set, it returns false.
Parameters: cookie - The name of the compressed cookie. (required)
find - The name of the cookie to get. If null then all cookies
will be retrived and global variables named after the
name of each cookie will contain the value of that
cookie. For example, a cookie named 'magic' containing
the value 'xyzzy' would set the variable 'g.magic' to
'xyzzy'.
Returns: The value of the cookie, unless the 'find' parameter was null,
in which case it returns true if any cookies were found. If no
cookies were found or the requested cookie wasn't set then it
returns null.
Version Information
cookie_tools.mv
Library: cookie_tools.mv
Version: 1.1
Date: November 17th, 1998
History:
- Version 1.1 - November 17th, 1998:
- Fixed:
- Fixed a bug in get_cookie, it didn't return true if find was null and a cookie was set.
- New:
- Added compress_cookie and get_compressed_cookie for compressed cookie support.
- Version 1.0 - ?
- First release.