Solved

Passing cookies and reading in the same script

Posted on 1998-09-21
6
143 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.

911 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

15 Experts available now in Live!

Get 1:1 Help Now