我的问题如下.密码被识别为有效后我需要重定向到main.cgi但是我收到的消息为:
Status: 302 Found
Location: http://localhost/cgi-bin/Main.cgi
Run Code Online (Sandbox Code Playgroud)
我知道这样做的原因是我之后正在写这个语句,Content-Type所以它将它作为HTML并在屏幕上打印.我是Perl的新手.任何人都可以帮我找到解决方案,让我的代码按照我想要的方式工作吗?或者请为我建议一些替代代码,或任何可能帮助我的链接.
#!C:\perl\bin\perl.exe
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use DBI;
my $q = new CGI;
print "Content-Type: text/html\n\n";
if ($q->param("Login")) {
my $Password = param('Password');
if (!$Password) {
print "Please Enter the Password";
} else {
my $dbh = DBI->connect(
"dbi:SQLite:DEVICE.db",
"", "",
{
RaiseError => 1,
AutoCommit => 1
}
);
my $sth = $dbh->prepare("select * from Settings where Password = ?");
$sth->execute($Password);
if (my $pass …Run Code Online (Sandbox Code Playgroud) 是Perl CGI的新手,使用ActivePerl,SQLite DB,Apache服务器和Windows.我有一个输入表单,其中包括Id,Name,Password等字段.每当有人创建新条目时,无论他们进入密码字段,应加密并存储在数据库中.
下一次当同一个用户输入密码时,应该验证它.现在我想要一个解密函数或代码.
我发现了一种叫做MD5加密的东西.请任何人可以给我更多关于此的信息,并帮助我如何编写代码或任何相关的链接?
我的代码中遇到了问题.每当我尝试插入文本字段时,它就会出错.这里的语法有什么问题?
print '<table>';
print "<tr style='background-color:#CDC9C9;'>
<td><A HREF=\"http://localhost/cgi-bin/AddUser.cgi\">ADD</A></td>
<td></td>
<td><b>UserId</b></td>
<td><input type="text" name="UserId"></td>
<td><b>UserName</b></td>
<td><input type="text" name="User_Name"></td>
<td><input type="submit" name="Filter" value="Filter"> </td>
</tr>";
print"</table>";
Run Code Online (Sandbox Code Playgroud)