Solved

Passing cookies and reading in the same script

Posted on 1998-09-21
6
142 Views
Last Modified: 2013-12-25
I set the cookie without any problems. Even MSIE reports "accepting a cookie". The problem is that the cookie doesn't take effect immediately, but it starts "working" at the second page I go.
i.e I have a script (Perl) for logging into something like a chatroom. When registering for chat, users define what kind of chat will they use (science, romance, etc...). When someone logs in, I send a cookie to recognize his interests on my further pages and to customize colors, graphics etc. But the problem is that on the very first page after log in, the cookie is "not activated" yet. Is there any solution or what am I doing wrong.
0
Comment
Question by:topalzzz
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:zhongbing
ID: 1828756
hi.
yse, it's possible, and there have been some questions of the same kind. so i don't paste the code here, u can check them.:
http://www.experts-exchange.com/topics/comp/lang/perl/Q.10082309
http://www.experts-exchange.com/topics/comp/www/cgi/Q.10075470

if u need more explaination or complete code, feel free to comment again.
0
 

Author Comment

by:topalzzz
ID: 1828757
Ok, perhaps I didn't define the question clearly.

I set the cookie without any problems. Even MSIE reports "accepting a cookie". The problem is that the cookie doesn't take effect immediately, but it starts "working" at the second page I go.
i.e I have a script (Perl) for logging in something like a chatroom. When registering for chat, users define what kind of chat will they use (science, romance, etc...). When someone logs in, I send a cookie to recognize his interests on my further pages and to customize colors, graphics etc. But the problem is that on the very first page after log in, the cookie is "not activated" yet. Is there any solution or what am I doing wrong.

I'll edit my first quiestion too.
0
 

Author Comment

by:topalzzz
ID: 1828758
Edited text of question
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:topalzzz
ID: 1828759
Adjusted points to 150
0
 
LVL 7

Accepted Solution

by:
faster earned 150 total points
ID: 1828760
You should have two cases, the first is when a cookie exists, (i.e. >= 2nd request), for this case you get the information you want from the cookie.  The 2nd case is no cookie found, when that happens, you need to do two things: one is to set the cookie as yo do now, the 2nd is to use this data directly.


0
 
LVL 7

Expert Comment

by:faster
ID: 1828761
For example, if you store the user preference in a database, then when a cookie is not found, you should use the information in the databases directly.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now