Solved

Passing cookies and reading in the same script

Posted on 1998-09-21
6
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

737 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