perl+CGI+Авторизация
Код:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head></head><title>Control Panel</title><body>";
print "<form action=\"login.cgi\" method=\"post\">";
print "<table align=\"center\">";
print "<tr><td>";
print "<input type=\"password\" name=\"password\">:Password";
print "<br><br><input type=\"submit\" value=\"Enter\">";
print "</tr></td></table><br>";
print "</body></html>";
print "Content-type: text/html\n\n";
print "<html><head></head><title>Control Panel</title><body>";
print "<form action=\"login.cgi\" method=\"post\">";
print "<table align=\"center\">";
print "<tr><td>";
print "<input type=\"password\" name=\"password\">:Password";
print "<br><br><input type=\"submit\" value=\"Enter\">";
print "</tr></td></table><br>";
print "</body></html>";
login.cgi содержит:
Код:
#!/usr/bin/perl
use CGI;
$query = new CGI;
$password="password";
$p = $query->param('password');
if ($p eq $password) {
print 'Status: 302 Moved', "\r\n", 'Location: ./options.cgi', "\r\n\r\n";
};
use CGI;
$query = new CGI;
$password="password";
$p = $query->param('password');
if ($p eq $password) {
print 'Status: 302 Moved', "\r\n", 'Location: ./options.cgi', "\r\n\r\n";
};
как сделать так что бы без этой авторизации не было доступа просто так к файлу options.cgi?