homepage Welcome to WebmasterWorld Guest from 54.161.147.106
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
Forum Library, Charter, Moderators: Receptional & mademetop

Website Analytics - Tracking and Logging Forum

    
Cookies and how to post set them in IE?
I am having trouble setting them in IE...
lak12




msg:891129
 2:02 am on Jun 15, 2001 (gmt 0)

Hi to all of you!
Well, I guess subject pretty much describes my problem. To be specific I am setting up cookies OK in Netscape using Perl as (just and example):

$expDate = "14-June-2001 01:30:45 GMT";

&setCookie("MemberIDLog", $memid, $expDate, $path, $domainc);

sub setCookie {
local($name, $value, $expiration, $path, $domain, $secure) = @_;

print "Set-Cookie: ";
print ($name, "=", $value, "; expires=", $expiration,
"; path=", $path, "; domain=", $domain, "; ", $secure, "\n");
}

It works fine. What do I have to do with headers to set up cookies properly in IE? I know IE is very strict on headers and any help would be greatly appreciated.
I need cookies to track members accessing my site as it is done here on WebmasterWorld server...
Thanks!
Mark.

 

Brett_Tabke




msg:891130
 4:47 pm on Jun 15, 2001 (gmt 0)

#---------------------------------------------------------GetCookies
# Get cookies.

@cookie_encode_chars = ('\%', '\+', '\;', '\,', '\=', '\&', '\:\:', '\s');
%cookie_encode_chars = ('\%','%25','\+','%2B','\;','%3B','\,','%2C','\=','%3D','\&','%26','\:\:','%3A%3A','\s','+');
@cookie_decode_chars = ('\+', '\%3A\%3A', '\%26', '\%3D', '\%2C', '\%3B', '\%2B', '\%25');
%cookie_decode_chars = ('\+',' ','\%3A\%3A', '::','\%26','&','\%3D','=','\%2C', ',','\%3B',';','\%2B','+','\%25','%');

sub getcookies {
$cookieflag = 0;
my ($cookie,$value,$char);
if ($ENV{'HTTP_COOKIE'}) {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@cookie_decode_chars) {
$cookie =~ s/$char/$cookie_decode_chars{$char}/g;
$value=~ s/$char/$cookie_decode_chars{$char}/g;
}
$COOKIE{$cookie} = $value;
}
$cookieflag = 1;
}
return $cookieflag;
}

#---------------------------------------------------------set cookie
#&setcookie("name,value,$expires");
# Set cookie.
# $cookieexp is used in days.

sub setcookie {
my ($cn,$cv,$cexp) =@_;
$ce =$cexp*86400+time if $cexp;
$ce ="" if !$cexp;
print &mycookies_header($ce,$cn,$cv);
}

#---------------------------------------------------------cookies_header
sub mycookies_header {
my ($expires, @cookies) = @_;
my ($header);
my ($cookie,$value, $chr);

my (@days) = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
my (@months) = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

my ($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime($expires);

$sec= "0".$secif ($sec < 10);
$min= "0".$minif ($min < 10);
$hour= "0".$hourif ($hour < 10);

if ($expires < 1) {
$expires = "";
} else {
$year += 1900;
$expires = "expires\=$days[$wday], $mday-$months[$mon]-$year $hour:$min:$sec GMT;";
}
while(($cookie,$value)=@cookies) {
foreach $char (@cookie_encode_chars) {
$cookie =~ s/$char/$cookie_encode_chars{$char}/g;
$value=~ s/$char/$cookie_encode_chars{$char}/g;
}
$header.= "Set-Cookie: $cookie=$value; $expires\n";
shift(@cookies);
shift(@cookies);
}
$cookie_out =1;
return $header;
}
-----
#example of setting a cookie:
sub myset_pw_cookie {
print &mycookies_header(time+31536000,"user",$inusername,"pw",$cryptinwd);
}

lak12




msg:891131
 10:41 pm on Jun 15, 2001 (gmt 0)

Thanks Brett!
Sometimes it takes tooo long to figure/find/work-out something that you need. Thanks. You saved me a day and I owe you one :-))
Regards.
Mark.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved