Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 3rd, 2000, 07:28 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old August 3rd, 2000, 03:22 PM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

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..."

Reply With Quote
  #3  
Old August 3rd, 2000, 04:21 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
<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.

Reply With Quote
  #4  
Old August 4th, 2000, 01:23 AM
MeijdenB MeijdenB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Alkmaar, The Netherlands
Posts: 123 MeijdenB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
<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

Reply With Quote
  #5  
Old August 6th, 2000, 12:34 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

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

Reply With Quote
  #6  
Old August 7th, 2000, 10:09 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
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.

Reply With Quote
  #7  
Old August 8th, 2000, 04:25 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #8  
Old August 8th, 2000, 08:21 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
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

Reply With Quote
  #9  
Old August 8th, 2000, 12:05 PM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

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

Reply With Quote
  #10  
Old August 8th, 2000, 12:49 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 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.

Reply With Quote
  #11  
Old August 8th, 2000, 04:09 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>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

Reply With Quote
  #12  
Old August 30th, 2000, 07:07 AM
MeijdenB MeijdenB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Alkmaar, The Netherlands
Posts: 123 MeijdenB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
<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).]

Reply With Quote
  #13  
Old August 30th, 2000, 06:15 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>And ALL browsers should (as everything on the web) obey tose headers.

Yes all should obey. But M$ often disobey RFC standards.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Cookie Problem again!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT