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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 28th, 2000, 01:09 AM
patrick patrick is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 0 patrick User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to patrick
does any one know how to use cookie in perl...
can teach me how to create the cookie in one page & the other page will know that the cookie had being created...eg other page can just use if($cookie) to koe if this person entering is authenticated

Reply With Quote
  #2  
Old November 28th, 2000, 06:09 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I recommend you to use cookie-lib.pl
http://www.egr.uri.edu/~kovacsp/cookie-lib/

Reply With Quote
  #3  
Old November 29th, 2000, 01:31 AM
patrick patrick is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 0 patrick User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to patrick
pepe thank for telling mi about the website..
but still I dont understand how can I use the script?
the cgi-lib & cookie-lib is text file...
how do i download & put it in in order to use it??pls help mi once again...thank!!

Reply With Quote
  #4  
Old November 29th, 2000, 08:24 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Download cookie-lib.txt, rename it to cookie-lib.pl and upload it to your cgi-bin directory.
You can use this library from your perl script by putting:

require "cookie-lib.pl";

line in your script. You can see syntax for using it at above link.
Here is simple script.cgi that reads cookie called "idcheck", and if cookie does not match your variable it sets the cookie.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>


#!/usr/bin/perl

require "cookie-lib.pl";

&get_cookie;

if ($cookie{'idcheck'} eq "oldvisitor" ) {

print "Location: <A HREF="http://www.mydomain.com/index.htmlnn";" TARGET=_blank>http://www.mydomain.com/index.htmlnn";</A>

}

else{

$cookie{'idcheck'} = $FORM{'oldvisitor'};

&set_cookie(1026432000, ".mydomain.com","/",0);

print "Location: <A HREF="http://www.mydomain.com/welcome.htmlnn";" TARGET=_blank>http://www.mydomain.com/welcome.htmlnn";</A>

}

[/code]


[This message has been edited by Pepe (edited November 29, 2000).]

Reply With Quote
  #5  
Old November 30th, 2000, 12:15 AM
patrick patrick is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 0 patrick User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to patrick
pepe i had downloaded the cookie-lib.txt & had renamed it with cookie-lib,pl....
ANd try with the script you had wrote..
but it did not work & prompt the error
>>>
cookie-lib.pl did not return a true value at
script.cgi at line2.
>>>
Name "main::FORM" use only once: possible typo at script.cgi at line8.

Pls give me some comment on the error....thank

Reply With Quote
  #6  
Old November 30th, 2000, 05:28 AM
Pepe Pepe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 71 Pepe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I had one error in previous code. This one works, I tried it, just change URLs to your own.
First time visitors will see /index.shtml and all returning visitors will go to /index.shtml
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
#!/usr/bin/perl
require "cookie-lib.pl";
&get_cookie;
if ($cookie{'idcheck'} eq "oldvisitor" ) {
print "Location: <A HREF="http://www.upitnik.net/index.shtmlnn";" TARGET=_blank>http://www.upitnik.net/index.shtmlnn";</A>
} else {
$cookie{'idcheck'} = "oldvisitor";
&set_cookie(1026432000, ".upitnik.net","/",0);
print "Location: <A HREF="http://www.upitnik.net/index2.shtmlnn";" TARGET=_blank>http://www.upitnik.net/index2.shtmlnn";</A>
}
[/code]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > cookie!!


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 4 hosted by Hostway