Chinaunix

标题: 用perl作为cgi编程如何实现认证? [打印本页]

作者: 怒剑狂啸    时间: 2003-05-07 07:41
标题: 用perl作为cgi编程如何实现认证?
比如类似于一个邮箱系统!用CGI模块编程时,password_field只能对该页面起作用,怎样才能实现对其他页面的访问控制?
作者: apile    时间: 2003-05-07 08:38
标题: 用perl作为cgi编程如何实现认证?
用cookie....
sub COOK {
        $username=$cookies{"username"};
        $password=$cookies{"password"};
}

sub GETCOOK {
        %cookies = map split(/=/), split(/; /,$ENV{'HTTP_COOKIE'});
}

## 設定COOKIE
sub SETCOOK
{
  $thePath = '/';
  $theDomain = '.com.tw';   #每一台web server之設定皆不同
  $exp_now = 'Wednesday, 09-Nov-90 23:12:40 GMT';
  $exp_later = '+30m';
  $eol = "\015\012";
  print "HTTP/1.0 200 OK$eolServer: MacHTTP$eolContent-type: text/html$eol";
  print "Set-Cookie:username=$username; path=$thePath$eol";
  print "Set-Cookie:password=$password; path=$thePath$eol";
}
作者: HonestQiao    时间: 2003-05-09 13:26
标题: 用perl作为cgi编程如何实现认证?
你可以有以下办法阿:
1.cookie
2.url附加信息
3.隐藏表单每个页面
4.构造session
作者: deathcult    时间: 2003-05-09 14:01
标题: 用perl作为cgi编程如何实现认证?
我工作中写cgi的时候,都是自己写来实现session
后来小应用就用php了。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2