⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wwwadmin.pl

📁 java开发的聊天室
💻 PL
📖 第 1 页 / 共 2 页
字号:
#!/usr/bin/perl

require "./wwwconfig.pl";
$use_time = 1;		# 1 = YES; 0 = NO

# Done
###########################################################################

if ($ENV{'QUERY_STRING'} ne '') {
   $command = "$ENV{'QUERY_STRING'}";
}
else {
   &parse_form;
}

print "Content-type: text/html\n\n";

###########################################################################
# Remove                                                                  #
#       This option is useful to see how the threads appear in the        #
#   wwwboard.html document.  It can give you a better idea of whether or  #
#   not you want to remove the whole thread or just part of it.           #
###########################################################################

if ($command eq 'remove') {
   print "<html><head><title>删除资料</title><BASEFONT FACE=Arial></head>\n";
   print "<body><center><h1>删除资料</h1></center>\n";
   print "<hr size=7 width=95% color=red><center><font size=-1>\n";
   print "[ <a href=\"$cgi_url\?remove\">删除资料</a> ] [ <a href=\"$cgi_url\?remove_by_date\">按时间删除</a> ] [ <a href=\"$cgi_url\?remove_by_author\">按作者删除</a> ] [ <a href=\"$cgi_url\?remove_by_num\">按编号删除</a> ] [ <a href=\"$baseurl/$mesgpage\">$title</a> ]\n";
   print "</font></center><hr size=7 width=95% color=red><p>\n";
   print "<form method=POST action=\"$cgi_url\">\n";
   print "<input type=hidden name=\"action\" value=\"remove\">\n";
   print "<table border>\n";
   print "<tr>\n";
   print "<th colspan=6>用户: <input type=text name=\"username\"> -- 口令: <input type=password name=\"password\"></th>\n";
   print "</tr><tr>\n";
   print "<th>编号</th><th>所有</th><th>单个</th><th>标题</th><th>作者</th><th>时间</th></tr>\n";

   open(MSGS,"$basedir/$mesgfile");
   @lines = <MSGS>;
   close(MSGS);

   foreach $line (@lines) {
      if ($line =~ /<!--top: (.*)--><li><a href="$mesgdir\/\1\.$ext">(.*)<\/a> - <b>(.*)<\/b>\s+<i>(.*)<\/i>/) {
         push(@ENTRIES,$1);
         $SUBJECT{$1} = $2;
         $AUTHOR{$1} = $3;
         $DATE{$1} = $4;
      }
   }

   @SORTED_ENTRIES = (sort { $a <=> $b } @ENTRIES);
   $max = pop(@SORTED_ENTRIES);
   $min = shift(@SORTED_ENTRIES);

   print "<input type=hidden name=\"min\" value=\"$min\">\n";
   print "<input type=hidden name=\"max\" value=\"$max\">\n";
   print "<input type=hidden name=\"type\" value=\"remove\">\n";

   foreach (@ENTRIES) {
      print "<tr>\n";
      print "<th><b>$_</b> </th><td><input type=radio name=\"$_\" value=\"all\"> </td><td><input type=radio name=\"$_\" value=\"single\"> </td><td><a href=\"$baseurl/$mesgdir/$_\.$ext\">$SUBJECT{$_} </a></td><td>$AUTHOR{$_} </td><td>$DATE{$_}<br></td>\n";

      print "</tr>\n";
   }
   print "</table>\n";
   print "<center><p>\n";
   print "<input type=submit value=\"删除资料\"> <input type=reset value=\"重置\">\n";
   print "</form>\n";
   print "</body></html>\n";
}

###########################################################################
# Remove By Number                                                        #
#       This method is useful to see in what order the messages were      #
#   added to the wwwboard.html document.                                  #
###########################################################################

elsif ($command eq 'remove_by_num') {
   print "<html><head><title>按编号删除资料</title><BASEFONT FACE=Arial></head>\n";
   print "<body><center><h1>按编号删除资料</h1></center>\n";
   print "<hr size=7 width=95% color=red><center><font size=-1>\n";
   print "[ <a href=\"$cgi_url\?remove\">删除资料</a> ] [ <a href=\"$cgi_url\?remove_by_date\">按时间删除</a> ] [ <a href=\"$cgi_url\?remove_by_author\">按作者删除</a> ] [ <a href=\"$cgi_url\?remove_by_num\">按编号删除</a> ] [ <a href=\"$baseurl/$mesgpage\">$title</a> ]\n";
   print "</font></center><hr size=7 width=95% color=red><p>\n";
   print "<form method=POST action=\"$cgi_url\">\n";
   print "<input type=hidden name=\"action\" value=\"remove\">\n";
   print "<table border>\n";
   print "<tr>\n";
   print "<th colspan=6>用户: <input type=text name=\"username\"> -- 口令: <input type=password name=\"password\"><br></th>\n";
   print "</tr>\n";
   print "<tr>\n";
   print "<th>编号</th><th>所有</th><th>单个</th><th>标题</th><th>作者</th><th>时间</th></tr>\n";

   open(MSGS,"$basedir/$mesgfile");
   @lines = <MSGS>;
   close(MSGS);

   foreach $line (@lines) {
      if ($line =~ /<!--top: (.*)--><li><a href="$mesgdir\/\1\.$ext">(.*)<\/a> - <b>(.*)<\/b>\s+<i>(.*)<\/i>/) {
         push(@ENTRIES,$1);
         $SUBJECT{$1} = $2;
         $AUTHOR{$1} = $3;
         $DATE{$1} = $4;
      }
   }

   @SORTED_ENTRIES = (sort { $a <=> $b } @ENTRIES);
   $max = pop(@SORTED_ENTRIES);
   $min = shift(@SORTED_ENTRIES);
   push(@SORTED_ENTRIES,$max);
   unshift(@SORTED_ENTRIES,$min);

   print "<input type=hidden name=\"min\" value=\"$min\">\n";
   print "<input type=hidden name=\"max\" value=\"$max\">\n";
   print "<input type=hidden name=\"type\" value=\"remove\">\n";

   foreach (@SORTED_ENTRIES) {
      print "<tr>\n";
      print "<th><b>$_</b> </th><td><input type=radio name=\"$_\" value=\"all\"> </td><td><input type=radio name=\"$_\" value=\"single\"> </td><td><a href=\"$baseurl/$mesgdir/$_\.$ext\">$SUBJECT{$_} </a></td><td>$AUTHOR{$_} </td><td>$DATE{$_}<br></td>\n";

      print "</tr>\n";
   }
   print "</table>\n";
   print "<center><p>\n";
   print "<input type=submit value=\"删除资料\"> <input type=reset value=\"重置\">\n";
   print "</form>\n";
   print "</body></html>\n";
}

###########################################################################
# Remove By Date                                                          #
#       Using this method allows you to delete all messages posted before #
#   a certain date.                                                       #
###########################################################################

elsif ($command eq 'remove_by_date') {
   print "<html><head><title>按时间删除资料</title><BASEFONT FACE=Arial></head>\n";
   print "<body><center><h1>按时间删除资料</h1></center>\n";
   print "<hr size=7 width=95% color=red><center><font size=-1>\n";
   print "[ <a href=\"$cgi_url\?remove\">删除资料</a> ]   [ <a href=\"$cgi_url\?remove_by_date\">按时间删除</a> ] [ <a href=\"$cgi_url\?remove_by_author\">按作者删除</a> ]   [ <a href=\"$cgi_url\?remove_by_num\">按编号删除</a> ] [ <a href=\"$baseurl/$mesgpage\">$title</a> ]\n";
   print "</font></center><hr size=7 width=95% color=red>\n";
   print "<p>\n";
   print "<form method=POST action=\"$cgi_url\">\n";
   print "<input type=hidden name=\"action\" value=\"remove_by_date_or_author\">\n";
   print "<input type=hidden name=\"type\" value=\"remove_by_date\">\n";
   print "<center>\n";
   print "<table border>\n";
   print "<tr>\n";
   print "<th colspan=4>用户: <input type=text name=\"username\"> -- 口令: <input type=password name=\"password\"><br></th>\n";
   print "</tr>\n";
   print "<tr>\n";
   print "<th>选择</th><th>时间</th><th>资料数</th><th>资料编号<br></th></tr>\n";

   open(MSGS,"$basedir/$mesgfile");
   @lines = <MSGS>;
   close(MSGS);

   foreach $line (@lines) {
      if ($line =~ /<!--top: (.*)--><li><a href="$mesgdir\/\1\.$ext">.*<\/a> - <b>.*<\/b>\s+<i>(.*)<\/i>/) {
         $date = $2;
         if ($use_time == 1) {
            ($time,$day) = split(/\s+/,$date);
         }
         else {
            $day = $date;
         }
         $DATE{$1} = $day;
      }
   }

   undef(@used_values);
   foreach $value (sort (values %DATE)) {
      $match = '0';
      $value_number = 0;
      foreach $used_value (@used_values) {
         if ($value eq $used_value) {
            $match = '1';
            last;
         }
      }
      if ($match == '0') {
         undef(@values); undef(@short_values);
         foreach $key (keys %DATE) {
            if ($value eq $DATE{$key}) {
               $key_url = "<a href=\"$baseurl/$mesgdir/$key\.$ext\">$key</a>";
               push(@values,$key_url);
	       push(@short_values,$key);
               $value_number++;
            }
         }
         $form_value = $value;
         $form_value =~ s/\//_/g;
         print "<tr>\n";
         print "<td><input type=checkbox name=\"$form_value\" value=\"@short_values\"> </td><th>$value </th><td>$value_number </td><td>@values<br></td>\n";
         print "</tr>\n";
         push(@used_values,$value);
         push(@used_form_values,$form_value);
      }
   }
   print "</table><p>\n";
   print "<input type=hidden name=\"used_values\" value=\"@used_form_values\">\n";
   print "<input type=submit value=\"删除资料\"> <input type=reset value=\"重置\">\n";
   print "</form></center>\n";
   print "</body></html>\n";
}

###########################################################################
# Remove By Author                                                        #
#       This option makes a list of all known authors and then groups     #
#    together there postings and allows you to remove them all at once.   #
###########################################################################

elsif ($command eq 'remove_by_author') {
   print "<html><head><title>按作者删除资料</title><BASEFONT FACE=Arial></head>\n";
   print "<body><center><h1>按作者删除资料</h1></center>\n";
   print "<hr size=7 width=95% color=red><center><font size=-1>\n";
   print "[ <a href=\"$cgi_url\?remove\">删除资料</a> ]   [ <a href=\"$cgi_url\?remove_by_date\">按时间删除</a> ] [ <a href=\"$cgi_url\?remove_by_author\">按作者删除</a> ]   [ <a href=\"$cgi_url\?remove_by_num\">按编号删除</a> ] [ <a href=\"$baseurl/$mesgpage\">$title</a> ]\n";
   print "</font></center><hr size=7 width=95% color=red>\n";
   print "<p>\n";
   print "<form method=POST action=\"$cgi_url\">\n";
   print "<input type=hidden name=\"action\" value=\"remove_by_date_or_author\">\n";
   print "<input type=hidden name=\"type\" value=\"remove_by_author\">\n";
   print "<center>\n";
   print "<table border>\n";
   print "<tr>\n";
   print "<th colspan=4>用户: <input type=text name=\"username\"> -- 口令: <input type=password name=\"password\"><br></th>\n";
   print "</tr>\n";
   print "<tr>\n";
   print "<th>选择</th><th>作者</th><th>资料数</th><th>资料编号<br></th></tr>\n";

   open(MSGS,"$basedir/$mesgfile");
   @lines = <MSGS>;
   close(MSGS);

   foreach $line (@lines) {
      if ($line =~ /<!--top: (.*)--><li><a href="$mesgdir\/\1\.$ext">.*<\/a> - <b>(.*)<\/b>\s+<i>.*<\/i>/) {
         $AUTHOR{$1} = $2;
      }
   }

   undef(@used_values);
   foreach $value (sort (values %AUTHOR)) {
      $match = '0';
      $value_number = 0;
      foreach $used_value (@used_values) {
         if ($value eq $used_value) {
            $match = '1';
            last;
         }
      }
      if ($match == '0') {
         undef(@values); undef(@short_values);
         foreach $key (keys %AUTHOR) {
            if ($value eq $AUTHOR{$key}) {
               $key_url = "<a href=\"$baseurl/$mesgdir/$key\.$ext\">$key</a>";
               push(@values,$key_url);
               push(@short_values,$key);
               $value_number++;
            }
         }
         $form_value = $value;
         $form_value =~ s/ /_/g;
         print "<tr>\n";
         print "<td><input type=checkbox name=\"$form_value\" value=\"@short_values\"> </td><th align=left>$value </th><td>$value_number </td><td>@values<br></td>\n";
         print "</tr>\n";
         push(@used_values,$value);
         push(@used_form_values,$form_value);
      }
   }
   print "</table><p>\n";
   print "<input type=hidden name=\"used_values\" value=\"@used_form_values\">\n";
   print "<input type=submit value=\"删除资料\"> <input type=reset value=\"重置\">\n";
   print "</form></center>\n";
   print "</body></html>\n";

}

###########################################################################
# Change Password                                                         #
#       By calling this section of the script, the admin can change his or#
#   her password.							  #
###########################################################################

elsif ($command eq 'change_passwd') {

   print "<html><head><title>修改管理帐号</title><BASEFONT FACE=Arial></head>\n";
   print "<body><center><h1>修改管理帐号</h1></center>\n";
   print "如果不填写新用户名将使用原用户名。<p><hr size=7 width=95% color=red><p>\n";
   print "<form method=POST action=\"$cgi_url\">\n";
   print "<input type=hidden name=\"action\" value=\"change_passwd\">\n";
   print "<center><table border=0>\n";
   print "<tr>\n";
   print "<th align=left>用户: </th><td><input type=text name=\"username\"><br></td>\n";
   print "</tr><tr>\n";
   print "<th align=left>口令: </th><td><input type=password name=\"password\"><br></td>\n";
   print "</tr><tr> </tr><tr>\n";
   print "<th align=left>新用户: </th><td><input type=text name=\"new_username\"><br></td>\n";
   print "</tr><tr>\n";
   print "<th align=left>新口令一次: </th><td><input type=password name=\"passwd_1\"><br></td>\n";
   print "</tr><tr>\n";
   print "<th align=left>新口令二次: </th><td><input type=password name=\"passwd_2\"><br></td>\n";
   print "</tr><tr>\n";
   print "<td align=center><input type=submit value=\"修改口令\"> </td><td align=center><input type=reset value=\"重置\"></td>\n";
   print "</tr></table></center>\n";
   print "</form></body></html>\n";

}

###########################################################################
# Remove Action                                                           #
#       This portion is used by the options remove and remove_by_num.     #

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -