#1
  1. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    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..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    <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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    Alkmaar, The Netherlands
    Posts
    123
    Rep Power
    15
    <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
  8. #5
  9. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    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
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    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.
  12. #7
  13. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    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
  16. #9
  17. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    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
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    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.
  20. #11
  21. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>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
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    Alkmaar, The Netherlands
    Posts
    123
    Rep Power
    15
    <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).]
  24. #13
  25. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>And ALL browsers should (as everything on the web) obey tose headers.

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

IMN logo majestic logo threadwatch logo seochat tools logo