📄 setup.cgi
字号:
#------------------------------------------------------#
# 本程序为Yuzi工作室提供 #
# Yuzi论坛3000 v3.20 免费版 #
#------------------------------------------------------#
######################## 设定部分 ########################
$admname = "yuzi"; # 社区区长名字
$delpsd = "abcd"; # 社区区长密码
$zyname = "中文CGI专门店"; # 主页名称
$zyurl = "http://www.yuzi.net";# 主页地址
$cityname = "Yuzi论坛3000"; # 社区名称
$imagurl = "http://yuzi.net/bbs3000/image"; # 图片位置
$filepath = "."; # CGI程序文件的绝对路径(NT用户才要更改此项)
$ImgDir = "../../htdocs/image"; # 存放图片文件目录的绝对路径(最后不用加"/")
$mailprg = "/usr/sbin/sendmail -t"; # Server上送信软件的位置 通常用此默认路径
$time_hour = "0"; # Server时区调整,小时。
$YBBCodeAllow = "is"; # 是否支持YBB代码 "no"=否 "is"=是
$qmybb = "off";# 是否允许签名中使用YBB代码的[img]语法 "off"=不允许 "on"=允许
######################## 设定结束 ########################
## 以下部分不需修改 ##
######################
$ym=&myurl;
$ImgurlDir="$imagurl/img";
$chklast="$filepath/data/chklast";
$datadir="$filepath/data";
$people="$filepath/data/people.cgi";
$list="$filepath/data/list.cgi";
$Cookie_Exp_Date = '';
$Cookie_Path = '';
$Cookie_Domain = '';
$Secure_Cookie = '0';
@Cookie_Encode_Chars = ('\%', '\+', '\;', '\,', '\=', '\&', '\:\:', '\s');
%Cookie_Encode_Chars = ('\%', '%25',
'\+', '%2B',
'\;', '%3B',
'\,', '%2C',
'\=', '%3D',
'\&', '%26',
'\:\:', '%3A%3A',
'\s', '+');
@Cookie_Decode_Chars = ('\+', '\%3A\%3A', '\%26', '\%3D', '\%2C', '\%3B', '\%2B', '\%25');
%Cookie_Decode_Chars = ('\+', ' ',
'\%3A\%3A', '::',
'\%26', '&',
'\%3D', '=',
'\%2C', ',',
'\%3B', ';',
'\%2B', '+',
'\%25', '%');
sub GetCookies {
local(@ReturnCookies) = @_;
local($cookie_flag) = 0;
local($cookie,$value);
if ($ENV{'HTTP_COOKIE'}) {
if ($ReturnCookies[0] ne '') {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
foreach $ReturnCookie (@ReturnCookies) {
if ($ReturnCookie eq $cookie) {
$Cookies{$cookie} = $value;
$cookie_flag = "1";
}
}
}
}
else {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
$Cookies{$cookie} = $value;
}
$cookie_flag = 1;
}
}
return $cookie_flag;
}
sub SetSecureCookie {
if ($_[0] =~ /^[01]$/) {
$Secure_Cookie = $_[0];
return 1;
}
else {
return 0;
}
}
sub SetCookies {
local(@cookies) = @_;
local($cookie,$value,$char);
while( ($cookie,$value) = @cookies ) {
foreach $char (@Cookie_Encode_Chars) {
$cookie =~ s/$char/$Cookie_Encode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Encode_Chars{$char}/g;
}
print 'Set-Cookie: ' . $cookie . '=' . $value . ';';
if ($Cookie_Exp_Date) { print ' expires=' . $Cookie_Exp_Date . ';'; }
if ($Cookie_Path) { print ' path=' . $Cookie_Path . ';'; }
if ($Cookie_Domain) { print ' domain=' . $Cookie_Domain . ';'; }
if ($Secure_Cookie) { print ' secure'; }
print "\n";
shift(@cookies); shift(@cookies);
}
}
sub SetCompressedCookies {
local($cookie_name,@cookies) = @_;
local($cookie,$value,$cookie_value);
while ( ($cookie,$value) = @cookies ) {
foreach $char (@Cookie_Encode_Chars) {
$cookie =~ s/$char/$Cookie_Encode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Encode_Chars{$char}/g;
}
if ($cookie_value) { $cookie_value .= '&' . $cookie . '::' . $value; }
else { $cookie_value = $cookie . '::' . $value; }
shift(@cookies); shift(@cookies);
}
&SetCookies("$cookie_name","$cookie_value");
}
sub GetCompressedCookies {
local($cookie_name,@ReturnCookies) = @_;
local($cookie_flag) = 0;
local($ReturnCookie,$cookie,$value);
if (&GetCookies($cookie_name)) {
if ($ReturnCookies[0] ne '') {
foreach (split(/&/,$Cookies{$cookie_name})) {
($cookie,$value) = split(/::/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
foreach $ReturnCookie (@ReturnCookies) {
if ($ReturnCookie eq $cookie) {
$Cookies{$cookie} = $value;
$cookie_flag = 1;
}
}
}
}
else {
foreach (split(/&/,$Cookies{$cookie_name})) {
($cookie,$value) = split(/::/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
$Cookies{$cookie} = $value;
}
$cookie_flag = 1;
}
delete($Cookies{$cookie_name});
}
return $cookie_flag;
}
##########
sub win{
&send_html;
print <<EOF;
<html><head><title>谢谢$username!您的信息已成功发出!</title><BODY background=$imagurl/bg.jpg>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=$cgiurl?id=$id">
<SCRIPT LANGUAGE="JavaScript">
expireDate = new Date;
if (expireDate.getYear() < 100) {
expireDate.setYear(expireDate.getYear() + 1900 + 1);
} else {
expireDate.setYear(expireDate.getYear()+1);
}
var username = getCookie("UserName");
var password = getCookie("Password");
if (password == null) {
var CookieName = "$username";
var CookiePW = "$userpsd";
if (password == null) {
document.cookie = "username=" + CookieName + ";expires=" + expireDate.toGMTString() + ";";
document.cookie = "password=" + CookiePW + ";expires=" + expireDate.toGMTString() + ";";
}
}
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return dc.substring(begin, end); }
}
return null;
}
</SCRIPT></head><br><br><br><br><br><p align=center>谢谢$username!您的信息已成功发出! </p><p align=center>【<a href="$cgiurl?id=$id">回$bbsname</a>】</p><p align=center><strong><big>2秒钟后自动返回......</big></strong></p></table></body></html>
EOF
exit;
}
##########
sub YBBCode {
my $ThePost = shift;
$ThePost =~ s/(^|\s)(http:\/\/\S+)\b/ <A HREF="$2" TARGET=_blank>$2<\/A> /isg;
$ThePost =~ s/(^|\s)(www\.\S+)\b/ <A HREF="http:\/\/$2" TARGET=_blank>$2<\/A> /isg;
$ThePost =~ s/(\[URL\])(http|https|ftp)(:\/\/\S+?)(\[\/URL\])/ <A HREF="$2$3" TARGET=_blank>$2$3<\/A> /isg;
$ThePost =~ s/(\[URL\])(\S+?)(\[\/URL\])/ <A HREF="http:\/\/$2" TARGET=_blank>$2<\/A> /isg;
$ThePost =~ s/(\[URL=)(http|https|ftp)(:\/\/\S+?)(])(.+?)(\[\/URL\])/<A HREF="$2$3" TARGET=_blank>$5<\/A>/isg;
$ThePost =~ s/(\[URL=)(\S+?)(])(.+?)(\[\/URL\])/<A HREF="http:\/\/$2" TARGET=_blank>$4<\/A>/isg;
$ThePost =~ s/(\[EMAIL\])(\S+\@\S+?)(\[\/EMAIL\])/ <A HREF="mailto:$2">$2<\/A> /isg;
$ThePost =~ s,(\[code\])(.+?)(\[/code\]),<BLOCKQUOTE><font size="2">code:<\/font><HR><pre>$2</pre><HR><\/BLOCKQUOTE>,isg;
$ThePost =~ s/(\[IMG\])(\S+?)(\[\/IMG\])/ <IMG SRC="$2"> /isg;
$ThePost =~ s/(\[color=red\])(\S+?)(\[\/color\])/<font color=red>$2<\/font>/isg;
$ThePost =~ s/(\[color=Black\])(\S+?)(\[\/color\])/<font color=Black>$2<\/font>/isg;
$ThePost =~ s/(\[color=Silver\])(\S+?)(\[\/color\])/<font color=Silver>$2<\/font>/isg;
$ThePost =~ s/(\[color=Gray\])(\S+?)(\[\/color\])/<font color=Gray>$2<\/font>/isg;
$ThePost =~ s/(\[color=pink\])(\S+?)(\[\/color\])/<font color=pink>$2<\/font>/isg;
$ThePost =~ s/(\[color=Maroon\])(\S+?)(\[\/color\])/<font color=Maroon>$2<\/font>/isg;
$ThePost =~ s/(\[color=Purple\])(\S+?)(\[\/color\])/<font color=Purple>$2<\/font>/isg;
$ThePost =~ s/(\[color=Fuchsia\])(\S+?)(\[\/color\])/<font color=Fuchsia>$2<\/font>/isg;
$ThePost =~ s/(\[color=Green\])(\S+?)(\[\/color\])/<font color=Green>$2<\/font>/isg;
$ThePost =~ s/(\[color=Lime\])(\S+?)(\[\/color\])/<font color=Lime>$2<\/font>/isg;
$ThePost =~ s/(\[color=Olive\])(\S+?)(\[\/color\])/<font color=Olive>$2<\/font>/isg;
$ThePost =~ s/(\[color=Yellow\])(\S+?)(\[\/color\])/<font color=Yellow>$2<\/font>/isg;
$ThePost =~ s/(\[color=Navy\])(\S+?)(\[\/color\])/<font color=Navy>$2<\/font>/isg;
$ThePost =~ s/(\[color=Blue\])(\S+?)(\[\/color\])/<font color=Blue>$2<\/font>/isg;
$ThePost =~ s/(\[color=Teal\])(\S+?)(\[\/color\])/<font color=Teal>$2<\/font>/isg;
$ThePost =~ s/(\[color=Aqua\])(\S+?)(\[\/color\])/<font color=Aqua>$2<\/font>/isg;
$ThePost =~ s/(\[color=orange\])(\S+?)(\[\/color\])/<font color=orange>$2<\/font>/isg;
$ThePost =~ s/(\[color=brown\])(\S+?)(\[\/color\])/<font color=brown>$2<\/font>/isg;
$ThePost =~ s/(\[color=navy\])(\S+?)(\[\/color\])/<font color=navy>$2<\/font>/isg;
$ThePost =~ s/(\[QUOTE\])(.+?)(\[\/QUOTE\])/ <BLOCKQUOTE><font size="2" face="$FontFace">引用:<\/font><HR>$2<HR><\/BLOCKQUOTE>/isg;
$ThePost =~ s/(\[i\])(.+?)(\[\/i\])/<i>$2<\/i>/isg;
$ThePost =~ s/(\[b\])(.+?)(\[\/b\])/<b>$2<\/b>/isg;
$ThePost =~ s/(\[u\])(.+?)(\[\/u\])/<u>$2<\/u>/isg;
$ThePost =~ s/(\[center\])(.+?)(\[\/center\])/<center>$2<\/center>/isg;
$ThePost =~ s/(\[marquee\])(.+?)(\[\/marquee\])/<marquee>$2<\/marquee>/isg;
$ThePost =~ s/(\[size=2\])(.+?)(\[\/size\])/<font size=2>$2<\/font>/isg;
$ThePost =~ s/(\[size=3\])(.+?)(\[\/size\])/<font size=3>$2<\/font>/isg;
$ThePost =~ s/(\[size=4\])(.+?)(\[\/size\])/<font size=4>$2<\/font>/isg;
return ($ThePost);
}
#########
sub send_html {
if ($has_send ne "1") {
print "Content-type: text/html\n\n";
$has_send = "1";
}
}
##########
sub viewjh{
open(TITLES,"$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
$size=0;
$size1=0;
$syy=$page-20;
$findtmp="$filepath/data/$id.yhq";
open(TMP,">$findtmp");
foreach $hastitle (@hastitles){
$hastitle =~ s/\n//g;
if($hastitle ne ""){
($index)=split(/\t/,$hastitle);
if ( -e "$filepath/list/$id/$index"){
open(TITLES,"$filepath/list/$id/$index");
@a=<TITLES>;
close(TITLES);
foreach $m (@a){
$m=~ s/\n//g;
if($m ne ""){
($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee)=split(/\t/,$m);
}
}
if ( -X "$filepath/list/$id/$re"){
$size=$size+1;
$newtitle=$rtitles."\t".$index."\t".$rusername."\t".$rcomment."\t".$rfrom."\t".$rhasreply."\t".$remote."\t".$rlastname."\t".$rlasttime."\t".$rhassee;
print TMP $newtitle."\n";
}
}
}
}
close(TMP);
open(TITLES,"$findtmp");
@hastitles=<TITLES>;
close(TITLES);
&send_html;
print <<EOF;
<html>
<head>
<title>$bbsname</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a:link { font-family: "宋体", "serif"; font-size: 9pt; color: #004080; text-decoration: none}
a:hover { color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited { text-decoration: none}
body { font-family: "宋体", "serif"; font-size: 9pt}
td { font-family: "宋体", "serif"; font-size: 9pt}
input { font-size: 9pt}
p { font-size: 9pt}
br { font-size: 9pt}
tr { font-size: 9pt}
table { font-size: 9pt}
input{font-size:9pt;background-color:#FFFFFF}
</style>
</head>
<body topmargin=0>
$htmlt
<table width=100% border=0 cellpadding=4 cellspacing=0 background=$imagurl/tablebg.gif>
<tr>
<td><font color=#FFFFFF>论坛名称:<a href=$cgiurl?id=$id><font color=#FFFFFF>$bbsname</a></font> 论坛版主:<a href=mailto:$amail><font color=#FFFFFF>$admname</a></font> <a href=yhreg.cgi?menu=viewuser&username=$fbzmc target=_blank><font color=#FFFFFF>$fbzmc</a></font></td>
<td><font color=#ffffff><marquee width=300>$jj</marquee></font></td>
<td align=right>
EOF
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl target=_blank><font color=#FFFFFF>$outurl</font></a></td>";
}
print <<EOF;
</tr>
</table>
<br>
<table border=0 cellPadding=0 cellSpacing=0 height=16 style=PADDING-LEFT: 10px; PADDING-RIGHT: 10px>
<tr>
<td height=16 width=500><table
border=0 width=100% cellspacing=0 cellpadding=0>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -