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

📄 friend.php

📁 bmb的论坛
💻 PHP
字号:
<?  
/* BMForum Plus! Bulletin Board Systems Version : Plus!  This is a freeware, but don't change the copyright information. A SourceForge Project - GNU Licence project. Web Site: http://www.bmforum.com Copyright (C) Bluview Technology*/            
require("datafile/config.php");
require("getskin.php");

if ($login_status==0) {
	include("header.php");
	navi_bar($gl[49],$gl[50]);
	msg_box($gl[50],$gl[51]);
	include("footer.php");
	exit;
}

if (empty($fusertype)){ 
include("header.php");
	navi_bar("$gl[52]","$gl[53]");
	$status="$gl[54]";
	print_err();
	include("footer.php");
	exit;
}
$current_time = date("F j, Y, g:i:s a");
$newstring="$friendname|$current_time|$fusertype|\n";
$favFile ="$id_unique/".$o_username.".frd"; 
if (!file_exists("$id_unique/".urlencode($friendname).".php")){
	include("header.php");
	navi_bar("$gl[55]",$gl[53]);
	$status="$friendname $gl[56]";
	print_err();
	include("footer.php");
	exit;
}
if (file_exists($favFile)){ //检查文件是否存在 
	$fp = fopen($favFile,"a"); 
	if (fwrite($fp,$newstring))  { $echoInfo="$gl[57]"; if($frdduan && $fusertype!="b" && $fusertype!="i") { mtou($friendname);} }
	else{ $echoInfo="$gl[58]"; }
	fclose($fp);
}else{ 
	$fp = fopen($favFile,"w"); //建立文件 
	if (fwrite($fp,$newstring)) { $echoInfo="$gl[57]"; if($frdduan && $fusertype!="b" && $fusertype!="i") { mtou($friendname);}
	}else{ $echoInfo="$gl[58]";}
	fclose($fp);
} 

	jump_page("friendlist.php",$echoInfo,
"$gl[3]
<ul>
<li><a href='friendlist.php'>$gl[15]</a></li><br>
</ul>");
function print_err() {
global $status,$gl;
	msg_box($gl[53],"$gl[59]<br><br>$status<br><ul><li><a href='javascript:history.back(1)'>$gl[15]</a></li></ul>");
}
function mtou($ruser) {
global $gl,$id_unique,$username,$timestamp,$short_msg_max;

	if (file_exists("$id_unique/".urlencode($ruser).".rec")) $msg=file("$id_unique/".urlencode($ruser).".rec");
	else $msg[0]="";
	$user="$gl[60]";
	$content="$username $gl[61]";
	$title="$gl[60]";
	$new="$user|$title|$timestamp|$content|0|\n";
	$oldcount=count($msg);
	if ($oldcount>$short_msg_max) {
		for ($i=$short_msg_max; $i<$oldcount; $i++) unset($msg);
	}
	$old=implode("",$msg);
	if (file_exists("$id_unique/".urlencode($ruser).".frd")) {
//------get the line from the original list------
		$fp=fopen("$id_unique/".urlencode($ruser).".frd","r");
		flock($fp,LOCK_SH);
		$oldlist=file("$id_unique/".urlencode($ruser).".frd");
		fclose($fp);
		$count=count($oldlist);	
		for ($i=0; $i<$count; $i++) {
			$detail=explode("|",$oldlist[$i]);
			if($detail[0]==$username && $detail[2]=="b") $uisbadu="yes";
			}
		}
		if ($uisbadu!="yes") writetofile("$id_unique/".urlencode($ruser).".rec",$new.$old);
	}
?> 

⌨️ 快捷键说明

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