Trying to write a simple Cookie/user SID display routine and I am getting a Permission Denied - any ideas? I've tried multple entries in the directory line as I figured that is where the error is originating from, and settled on the current ../../http-docs which I know to be "accessable".
#!/usr/bin/perl
use CGI;
use Apache::Session::File;
my $query = new CGI;
my %session;
my $id = undef;
$id = $query->cookie(-name=>"SID01");
tie %session, 'Apache::Session::File', $id,
{ Directory => "../../http-docs/",
LockDirectory =>"../../http-docs/"};
if ($id == undef) {
$cookie = $query->cookie( -name=>'SID01',
-value=>$session{_session_id},
-expires=>'+1y',
-path=>'/session');
print $query->header(-cookie=>$cookie);
print "Assigned session ID<br>n";
} else {
print $query->header();
print "Not assigned session ID<br>n";
};
$id = $session{_session_id};
print "Content-type: text/html\n\n";
print "<html>n";
print " <head><title>Session ID</title></head>n";
print " <body bgcolor=#ffffff>n";
print " Your session ID is $idn";
print " </body>n";
print "</html>n";
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.