Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am having a few problems with cookies.

My script worked perfectly until we did some maintenance on the servers and upgraded the firewall. Now suddenly my script doesn't want to create cookies anymore. My script haven't changed and the apache config looks the same.

I have no idea where to start looking for problems.

Here is a snippet of code:

$query = new CGI; # $menu and $name is passed to this script # $menu is not defined when the script is called the first time if (!(defined($menu))) { if (!(defined($name))) { print $query->redirect('http://blahblah.com/cgi-bin/pdf_lo +gin.cgi'); }; my $cookie_name = $query->cookie("name"); if ($cookie_name ne $name) { my $cookie = $query->cookie (-name => 'name', -value => $name, -domain => 'blahblah.com', -expires => '+10y'); my $myurl = 'http://blahblah.com/cgi-bin/login.cgi?name='.$nam +e; #This redirects to the same script print $query->redirect (-cookie => $cookie, -uri => $myurl); exit 0; }; } else { my $cookie_name = $query->cookie("name"); $name = $cookie_name; };

The script relies on the cookie being set, if not it calls the same URL and sets the cookie. What seems to happen is that it is calling the same script over and over and never sets the cookie. I am sure that the browser I am testing it on accepts cookies.

Any ideas would be appreciated, I have no idea where to start. I took out the checking part and everything works perfectly.

--Siddartha


In reply to The cookie crumbles by Siddartha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found