|
发表于 2004-4-15 02:07:48
|
显示全部楼层
不知道可以換個方式嗎?
我也是初學者
#!/usr/bin/perl
## 文件檔案index.pl
use CGI ':standard';
use CGI::Carp 'fatalsToBrowser';
use strict;
my $name = cookie('sessionID') || 'geust';
my $space = ' ' x 9;
print header(-charset=>'big5',-expires=>'-1d'),
start_html(-title=>'Welcome to My Page',
-lang=>'big5',
-encoding=>'big5');
print h2({-align=>'center'},'Create new account'),
h2("Hi$space$name"),hr,
start_form(-action=>'create.pl',-method=>'post'),
'帳號',br,br,
textfield(-name=>'user',
-override=>'1',
-size=>'20',
-maxlength=>'40'),br,br,
'密碼',br,br,
password_field(-name=>'password',
-override=>'1',
-size=>'21',
-maxlength=>'40'),br,br,
submit('傳送'),
end_form,
end_html;
........................完
#!/usr/bin/perl
## 文件檔案 create.pl
use CGI ':standard';
use CGI::Carp 'fatalsToBrowser';
use strict;
my $user = param('user');
my $password = param('password');
my $space = ' ' x 9;
my $cookie = cookie( -name=>'sessionID',
-value=>"$user",
-expires=>'+1y');
print redirect('index.pl') unless ($user && $password);
print header(-charset=>'big5',
-cookie=>$cookie),
start_html(-title=>'Create new account',
-lang=>'big5',
-encoding=>'big5');
print "以下是妳申請的資料",hr,br,br,
"帳號",$space,$user,br,
"密碼",$space,$password,br,br,
a({href=>'index.pl'},'回主頁')
........................完 |
|