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=>'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://myaddressgoeshere.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.
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=>'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://myaddressgoeshere.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.