Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: incrediBILL
(1) use Perl's CGI.pm module
(2) Don't try to shove cookies down peoples throats on every single page. Some people have cookie warnings turned on and this makes your site almost unusuable to them. Ideally you should try to give them a cookie one time and never again (for that session).
(3) Ideally you have a database to keep track of your users, so the only cookie you ever need to give them is their user ID cookie, which is usually a big number. Then all the data you want to track can be kept in the record. This is better (for several reasons) than stuffing all the data into their cookie cache.
(4) Make your site "non-cookie friendly." Let your cookie users reap the benefits of cookies, but non-cookie users should still be able to use your site.
If you want to start looking at actual Perl code lets take this discussion over to the server-side scripting forum...
There are ways to do this entirely in Java without using CGI at all. I don't advise it, that's just another layer of stuff that can break for some people.
So go to your Linux prompt and type "perldoc CGI" and read the section on cookies. You'll see lots of examples; it's pretty easy stuff.
Then on the way back, you make sure that random number matches the one you gave. The reason for this is that otherwise, somebody could impersonate somebody else by entering your welcomeback.pl script with a "forged cookie." If you're worried about that.