<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1000929" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1000929</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/setting-and-getting-cookies#comment-1003921</link>
    <description> &lt;p&gt;I think I can do that.  &lt;img src=&quot;http://www.webmaster-forums.com/ubb/smile.gif&quot; alt=&quot;&quot; class=&quot;bb-image&quot; /&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;code:&lt;/p&gt;
&lt;pre&gt;
print &quot;Set-Cookie: name=1:3:6:72:23:25:65:23432:324324; expires=Monday, 12-Dec-2000 00:00:00 GMT; path=/DIR; domain=DOMAIN_NAME;&quot;;
print &quot;Content-type: text/html\n\n&quot;;
[/code]

DIR is where you put the dir of your web site on the server (http not absoulate path). DOMAIN_NAME is where you put the domain of your server. For instance, if your address was &lt;a href=&quot;http://www.linux.com/cookies&quot; class=&quot;bb-url&quot;&gt;www.linux.com/cookies&lt;/a&gt; 
then DIR would be /cookies and DOMAIN_NAME would be &lt;a href=&quot;http://www.linux.com&quot; class=&quot;bb-url&quot;&gt;www.linux.com&lt;/a&gt;  or linux.com. Never put the print &quot;Content-type: text/html\n\n&quot;; before the set cookie line or it will print out the cookie. 

Now to read the cookie.

&lt;BLOCKQUOTE&gt;code:&lt;pre&gt;
#!/usr/bin/perl
print &quot;Content-type: text/html\n\n&quot;;

sub getCookies {
	local(@rawCookies) = split (/; /,$ENV{&#039;HTTP_COOKIE&#039;});
	local(%cookies);

	foreach(@rawCookies){
	    ($key, $val) = split (/=/,$_);
	    $cookies{$key} = $val;
	} 

	return %cookies; 
} 

%cookies = &amp;getCookies;
[/code];

if you&#039;ve ever seen a sub routine for processing forms this looks very familiar. To read the cookies you just type print &quot;$cookies{&#039;COOKIE_NAME&#039;}\n&quot;;

Hope that clears it up for you. &lt;/pre&gt;&lt;/blockquote&gt;&lt;/pre&gt;&lt;/blockquote&gt;</description>
     <pubDate>Wed, 19 Jan 2000 20:37:00 +0000</pubDate>
 <dc:creator>Orpheus</dc:creator>
 <guid isPermaLink="false">comment 1003921 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
