📄 signup.cgi
字号:
#!/usr/bin/perluse DBI;require "common.cgi";$passwdfile = "usrpasswd.txt"; &parse_form; $usrdir= "$basedir/$FORM{'bookname'}"; if (!($FORM{'bookname'})){ print "Content-type: text/html\n\n"; &error_disp("你的 ..黑客"); } &readcfg; if($disablepost eq "1") { &error_disp("斑竹停止了新用户注册功能."); } if ($FORM{'userid'}) { if (!($FORM{'password'})){ print "Content-type: text/html\n\n"; &error_disp("无密码"); }elsif (!($FORM{'passwdanswer'})){ print "Content-type: text/html\n\n"; &error_disp("没有提供密码答案"); } $userid=$FORM{'userid'}; $oldpassword=$FORM{'password'}; $passwdtype=$FORM{'passwdtype'}; $passwdanswer=$FORM{'passwdanswer'}; open (FILE,"$usrdir/$passwdfile"); @lines=<FILE>; close(FILE); foreach ($j = 0;$j <= @lines;$j++) { ($username,$passwd) = split(/:/,$lines[$j]); if ($userid eq $username) { print "Content-type: text/html\n\n"; &error_disp("用户名 $userid已经在本论坛存在! 请重新取一个用户名!"); } } $dbh = DBI->connect("DBI:mysql:database=$database;host=$hostname","$dbuser", "$dbpassword",{'RaiseError' => 1}); $sth = $dbh->prepare("select * from password where userid='$userid'"); $sth->execute(); ($userid1,$password1) = $sth->fetchrow_array(); if ($password1){ print "Content-type: text/html\n\n"; $dbh->disconnect; &error_disp("用户名 $userid已经在乐趣园存在! 请重新取一个用户名!"); } $bookname=$FORM{'bookname'}; #$sth = $dbh->do("INSERT INTO password VALUES ('$userid',PASSWORD('$oldpassword'))"); #$sth = $dbh->do("INSERT INTO passwordassit VALUES ('$userid','$oldpassword','$passwdtype','$passwdanswer')"); #$sth = $dbh->do("INSERT INTO userclub VALUES ('$userid','$bookname','0')"); #$rc = $dbh->disconnect; $test_passwd = crypt($FORM{'password'}, substr($FORM{'password'}, 0, 2)); open (FILE,">>$usrdir/$passwdfile"); $line="$userid:$test_passwd:$ENV{'REMOTE_ADDR'}:0:0\n"; print FILE $line; close(FILE);# print "Content-type: text/html\n\n"; # print "$usrdir/$passwdfile $userid:$test_passwd:$ENV{'REMOTE_ADDR'}:0:0\n"; print "Window-target: _top\n"; print "Location: http://signup.netsh.com/signup.jsp?userid=$userid&password=$oldpassword&passwdtype=$passwdtype&passwdanswer=$passwdanswer&bookname=$bookname\n\n"; } else{ print "Content-type: text/html\n\n"; print "test"; }sub parse_form {undef %FORM;undef @pairs;undef $buffer;if ($ENV{'QUERY_STRING'} ne '') { $buffer = "$ENV{'QUERY_STRING'}";}else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});} # Split the name-value pairs@pairs = split(/&/, $buffer);foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<([^>]|\n)*>//g; $FORM{$name} = $value;}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -