Solved

Passing cookies and reading in the same script

Posted on 1998-09-21
6
147 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
PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

 

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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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 …
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…

626 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