|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hai,
i have a script that will set a cookie when a user login to the system. I could able to set up the cookie for the netscape but for the Internet Explorer it is not at all setting up the cookie. I am using CGI.pm for my CGI programs. I am using this header information. 167 $l = $query->param('code'); 168 $p = $query->param('passwd'); 169 170 $CookieID = "$l"."+"."$p"; 171 172 $cookies = $query->cookie( 173 -name=>'brilines', 174 -value=>$CookieID, 175 -expires=>'+1h' 176 ); 177 178 print $query->header(-cookie=>$cookies); Any body please help me in solving this problem? vijay |
|
#2
|
||||
|
||||
|
Vijay, try with the following example... #!/usr/bin/perl use CGI; $q=new CGI; $cookie=cookie(-name=>'brilines', -value=>$CookieID, -expires=>'+1h', -path='/', -domain='www.yourdomain.com'); print $q->header(-cookie=$cookie); print "Cookie has been set!!n"; ------------------ SR - webshiju.com "The fear of the LORD is the beginning of knowledge..." |
|
#3
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
Any body please help me in solving this problem? [/quote] Yes, don't use CGI.pm. |
|
#4
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
Yes, don't use CGI.pm.[/quote] I agree, print your own headers eg: print "Set-Cookie: brilines=$CookieID; expires=+1hnn"; ------------------ Good luck, Bas ------------------ E-mail me at: b.vandermeijden@pecoma.nl |
|
#5
|
|||
|
|||
|
hai where can i find more information about standard headers? i think there are two seperate headers i have to write for IE as well as Netscape ? Is it correct? vijay |
|
#6
|
|||
|
|||
|
Nope.
As far as I know the header doesn't interact with the browsers too much. It interacts with the web server, which then works with the browser. |
|
#7
|
|||
|
|||
|
But,
i thing it is not correct . the problem is the header information for two browsers varies you know. For Example, this header doesn't work with IE print "Set-Cookie: brilines=$CookieID; expires=+1hnn"; So it is incorrect to say that "It (the header) interacts with the web server, which then works with the browser. " I am doing a lot of R&D with this .. Anybody having this knowledge please help me in finding the solution for this. The problem it requires seperate headers for each of IE and Netscape ? How can i check in my perl program the browser.? vijay |
|
#8
|
|||
|
|||
|
Well if you're going to use lazy *** (pardon my language, but it fits the situation best) scripting like:
print "Set-Cookie: brilines=$CookieID; expires=+1hnn"; You can fix that by finding the true expiration date and using it instead of "+1h". I didn't even thing "+1h" even worked if you weren't using CGI.pm |
|
#9
|
|||
|
|||
|
Anybody please tell me how to write seperate programs that will set up each headers. B'cause i want to write seperate headers for each Browser. I know that it can be done by using environmental variable HTTP_USER_AGENT.. What is the value for each browser .. I checked with IE 4.0 and Netscape 4.61 .. For IE 4.0 it says Mozilla4.01 ... For Netscape also it says Mozilla4.61 ... How can i check for the browser ? vijay |
|
#10
|
|||
|
|||
|
I'm not sure what your different headers would be. Please tell what two headers you plan on writing and how they are different (just curious).
If you're checking the HTTP_USER_AGENT it'll show up as something like this (for IE): Mozilla/4.0 (compatible; MSIE 5.5; Windows 95; SQSW) Search the variable for MSIE, if it's found, then you've got IE. If it's not, search for Mozilla, if it's not found, they're using some other browser. |
|
#11
|
|||
|
|||
|
>>What is the value for each browser ..
Start here -> http://www.perl.com/CPAN-local/modules/by-module/HTTP/ and download HTTP-BrowserDetect-0.95.tar.gz |
|
#12
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by chinnavi:
Anybody please tell me how to write seperate programs that will set up each headers. [/quote] In my honoust and humble opinion you don't need to write seperate headers. These headers are defined in the HTTP 1.0 (RFC 1945) and 1.1 (RFC 2616) specs (These might differ some what). And ALL browsers should (as everything on the web) obey tose headers. So why do you want to write seperate headers? Bas ------------------ Good luck, Bas ------------------ E-mail me at: b.vandermeijden@pecoma.nl [This message has been edited by MeijdenB (edited August 30, 2000).] |
|
#13
|
|||
|
|||
|
>>And ALL browsers should (as everything on the web) obey tose headers.
Yes all should obey. But M$ often disobey RFC standards. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Cookie Problem again! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|