Greetings everyone! I'm a newbie to Perl, hopefully some of you more experienced programmers can help me out.

I have 3 questions:

1: I have the following code creating a cookie:

use CGI; $query = new CGI; my $cookie = $query->cookie(-name=>'cookie', -value=>'hello', -domain= +>'www.cis$ print $query->header(-cookie=>$cookie);

this scrpt (login.cgi)is in the cgi-bin directory, I forward this script to home.cgi in the same cgi-bin directory and works fine when it accesses the cookie in home.cgi, however, when I put home.cgi one directory above cgi-bin, the cookie is not accessed.

The following is the cookie retrieving code in home.cgi:

#print "Content-type: text/html\n\n"; $query = new CGI; $cookie = $query->cookie('cookie'); print $query->header(); if ($cookie) { #print "Content-type: text/html\n\n"; $query = new CGI; $cookie = $query->cookie('cookie'); print $query->header(); if ($cookie) { print "done"; } else { print "naughty boy!" #print "#print "<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://myadd +ressgoeshere.com/cgi-bin/login.cgi">"; }

why is done printed if I put the cookie in the same directory, but naughty boy is printed if I put it in another directory> I tried changing the other parameters in cookie creation to make the cookie accessible in the whole domain of my website, but for some reason this is not working!

2: Another thing, the meta tag that I have commented out, does not work even when the elseif is taken, is there anything wrong with the tag, is global accessing like that alright?

3: Lastly, I am writting my html files with dreamweaver, however, if I want to read them in again, all this extra code that checks for the cookie and so forth prevents me from seeing anything but the code view in dreamweaver, does perl have any way to redirect to a file within a secure directory. This would solve two problems

  1. I won't have to check for cookies at all
  2. I would redirect to a complete html file (not mixed with cgi) so that I could edit it with dreamweaver.

If this is not possible, how do you redirect to an unsecure file (without the html meta tag).

Thanks a bunch.

Edited by Chady -- added formatting tags.


In reply to Cookies and things... by pmachin

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.