www.pudn.com > bbs3000afree.zip > friend.cgi


#!/usr/bin/perl 
#------------------------------------------------------# 
#         本程序为Yuzi工作室提供        # 
#        Yuzi论坛3000(BBS3000)v4.00      # 
#------------------------------------------------------# 
$cgipa=".";  # CGI程序文件的绝对路径 
###################### 
## 以下部分不需修改 ## 
###################### 
require "$cgipa/setup.cgi"; 
&GetCookies; 
if($Cookies{username} eq ""){&okview("您当前的身份是访客,请登陆!");} 
########## 
if ($ENV{'REQUEST_METHOD'} eq "POST") { 
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); 
} 
else { 
$buffer = $ENV{'QUERY_STRING'}; 
} 
@pairs = split(/&/, $buffer); 
foreach $pair (@pairs) { 
($name, $value) = split(/=/, $pair); 
$value=~tr/+/ /; 
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 
$value=~s/\t/    /g; 
$value=~s/>/>/g; 
$value=~s/; 
close(PSD); 
foreach $line (@lines) { 
chomp($line); 
open(yhzl,"$filepath/yhzl/$line.cgi"); 
$yhzl=; 
close(yhzl); 
($rdpassword,$rdname,$rdmail,$rdhome,$rdlasttime,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu)=split(/\t/,$yhzl); 
$friend="$friend $rdname";} 
open(yhzl,"$filepath/yhzl/$Cookies{username}.cgi"); 
$yhzl=; 
close(yhzl); 
($rdpassword,$rdname,$rdmail,$rdhome,$rdlasttime,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu)=split(/\t/,$yhzl); 
print "Content-type: text/html\n\n"; 
print <$Cookies{username}的网络寻呼机
我的好友
$friend
添 加
删 除
BBS3000
EOF $counter ="$filepath/guest/2$Cookies{username}.cgi"; open(NUMBER,"$counter"); $NUMBER=; close(NUMBER); ($lys,$oldlys,$money,$charm)=split(/\t/,$NUMBER); if ($lys>0){ print ""; open(NUMBER,">$counter"); print NUMBER "0"."\t\t"."$money"."\t"."$charm"; close(NUMBER); } exit; ########## sub addhtml{ open(yhzl,"$filepath/yhzl/$Cookies{username}.cgi"); $yhzl=; close(yhzl); ($rdpassword,$rdname,$rdmail,$rdhome,$rdlasttime,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu)=split(/\t/,$yhzl); print "Content-type: text/html\n\n"; print <$Cookies{username}的好友名单
添加好友





好友名字

删 除
返回列表
BBS3000
EOF exit; } sub delhtml{ open(PSD,"$filepath/friend/$Cookies{username}.cgi"); @lines=; close(PSD); foreach $line (@lines) { chomp($line); open(yhzl,"$filepath/yhzl/$line.cgi"); $yhzl=; close(yhzl); ($rdpassword,$rdname,$rdmail,$rdhome,$rdlasttime,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu)=split(/\t/,$yhzl); $friend="$friend $rdname 删 除";} open(yhzl,"$filepath/yhzl/$Cookies{username}.cgi"); $yhzl=; close(yhzl); ($rdpassword,$rdname,$rdmail,$rdhome,$rdlasttime,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu)=split(/\t/,$yhzl); print "Content-type: text/html\n\n"; print <$Cookies{username}的网络寻呼机
删除好友
$friend
添 加
返回列表
BBS3000
EOF exit; } ######## sub add{ if($add eq ""){&okview("请输入好友的名字!");} if($Cookies{username} eq $add){&okview("不能添加自己!");} unless(-e "$filepath/yhzl/$add.cgi"){&okview("对不起,此名字没有在本论坛注册过!");} open(PSD,"$filepath/friend/$Cookies{username}.cgi"); @lines=; close(PSD); $fno=@lines; if($fno > 19){&okview("无法添加好友,系统限定好友人数不得超过20人!");} foreach $line (@lines) { chomp($line); if($line eq $add){ print "Content-type: text/html\n\n";exit; }} open(PSD,">>$filepath/friend/$Cookies{username}.cgi"); print PSD $add."\n"; close(PSD); print "Content-type: text/html\n\n";exit; } sub del{ open(TITLES5,"$filepath/friend/$Cookies{username}.cgi"); @hastitles5=; close(TITLES5); open(TITLES5,">$filepath/friend/$Cookies{username}.cgi"); foreach $m5 (@hastitles5){ chomp($m5); if($m5 ne $add){ print TITLES5 $m5."\n"; }} close(TITLES5); print "Content-type: text/html\n\n";exit; } sub fshtml{ if($Cookies{username} eq $add){&okview("不能自己给自己发讯息!");} open(yhzl,"$filepath/yhzl/$add.cgi"); $yhzl=; close(yhzl); ($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$savecookie)=split(/\t/,$yhzl); print "Content-type: text/html\n\n"; print <发送消息
发送消息
 昵称: Email: 用户详细资料
EOF exit; } sub look{ open(PSD,"$filepath/guest/1$Cookies{username}.cgi"); @lines=; close(PSD); $line=@lines[$page]; ($no,$who,$myname,$sjian,$nr)=split(/\|/,$line); $nr=~s/<([^>]|\n)*>/\n/g; ($sjian1,$sjian2)=split(/\./,$sjian); open(PSD,"$filepath/yhzl/$who.cgi"); $lines=; close(PSD); ($rpassword,$rname,$rmail,$rhome,$rlast,$rqm,$rsex,$rwork,$rcity,$rlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ)=split(/\t/,$lines); $page++; $spage=$page-2; if($page > 1){$back="";} print "Content-type: text/html\n\n"; print <查看消息
查看消息
 昵称: Email:  日期:  时间: 用户详细资料
$back <<上一条 
 下一条>> 
EOF exit; } sub chatlog{ open(PSD,"$filepath/guest/1$Cookies{username}.cgi"); @lines=; close(PSD); foreach $line (@lines) { ($no,$who,$myname,$sjian,$nr)=split(/\|/,$line); if($who eq $add || $myname eq $add){ $nr=~s/<([^>]|\n)*>/\n/g; chomp($nr); $nr =~s/\(收件人:(\S+?)\)//isg; $chatlog="$chatlog($sjian)  $who\n$nr\n\n"; }} open(PSD,"$filepath/yhzl/$add.cgi"); $lines=; close(PSD); ($rpassword,$rname,$rmail,$rhome,$rlast,$rqm,$rsex,$rwork,$rcity,$rlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ)=split(/\t/,$lines); $page++; if($page > 2){$spage=$page-2;} print "Content-type: text/html\n\n"; print <聊天记录
聊天记录
 昵称: Email: 用户详细资料
EOF exit; } ######################### END OF SCRIPT #########################