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

📄 viewfav.php

📁 FTB安装版 v1.3(虚拟形象)FTB安装版 v1.3(虚拟形象)
💻 PHP
字号:
<?;
require("userdata/style.php");
require("global.php");
if(!$ofstarjob){
$headguide_des="您现在正处在<br>帖子收藏程式中";
$headguide_l2="<a onfocus=this.blur()  href='thread.php?forumid=$forumid'>$forum_name</a>";
if (empty($username)) {
         require("header.php");echo"$headertp";
         headguide($headguide_des,$headguide_l2,"发生错误");
	 $status="您尚未登陆或注册";
         print_err();
         require("footer.php");echo"$footertp";
         exit;
     } 
if (empty($page)) $page=1;
$forum_name="查看收藏夹";
$add_title=" &gt; $forum_name";
require("header.php");echo"$headertp";
$favFile ="userdata/favorites/".$username.".txt"; 
if (file_exists($favFile)) {
     $temp=file($favFile);
     $amount=count($temp);
}
else $amount=0;
$des="您现在正在访问的是 收藏夹<br>目前共收藏 <b>$amount</b> 篇文章";
headguide($des,$forum_name);
?>
<br>
<?
echo <<<EOT
<table width=$tablewidth border=0 cellspacing=0 cellpadding=0 align=center bgcolor=$bordercolor>
<tr><td><table cellspacing=1 cellpadding=4 border=0 width=100%><tr align=center>
<td bgcolor=$article_color2 width=25%>控制面板首页</td>
<td bgcolor=$article_color2 width=25%><a href=profile.php>编辑个人资料</a></td>
<td bgcolor=$article_color2 width=25%><a href=profile.php?job=show&target=$username>查看个人资料</a></td>
<td bgcolor=$article_color2 width=25%><a href=viewfav.php>收藏夹</a></td>
</tr></table></td></tr></table><br>
<table cellspacing=0 cellpadding=0 width=$tablewidth align=center bgcolor=$bordercolor border=0><tr><td height=1></td></tr></table>
<table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=1 bgcolor=$titlecolor bordercolor=$bordercolor>
  <tr align=center height=26>
    <td colspan=2 width=* class=title><b>主&nbsp;&nbsp;题</b></td>
    <td width=120><b class=title>作 者</b></td>
    <td width=160><b class=title>版 块</b></td>
    <td width=50><a onfocus=this.blur()  href='viewfav.php?ofstarjob=del&filename=all'><b class=title>清 空</b></a></td>

  </tr>
</table>
EOT;
$favFile ="userdata/favorites/".$username.".txt"; 
if (file_exists("$favFile")) { 
$chkFp=fopen("$favFile","r"); 
flock($chkFp,LOCK_SH); 
$checkStr = fread($chkFp,20); 
fclose($chkFp); 
} 

if (file_exists("$favFile") && trim($checkStr) != "") {

	$total=( max($page,10) * $perpage );
	$fp=fopen($favFile,"r");
	flock($fp,LOCK_SH);
	$count=0;
	while (!feof($fp) && $count<$total) {
		$article_list[]=fgets($fp,800);
		$count++;
	}
	fclose($fp);
	if (!$article_list[$count-1]) {
		unset ($article_list[$count-1]);
		$count--;
	}
	if ($count%$perpage==0) $maxpageno=$count/$perpage;
		else $maxpageno=floor($count/$perpage)+1;
	if ($page>$maxpageno) $page=$maxpageno;
	$pagemin=min( ($page-1)*$perpage , $count-1);
	$pagemax=min( $pagemin+$perpage-1, $count-1);
	for ($i=$pagemin; $i<=$pagemax; $i++) {
		$a_info=$article_list[$i];
		articleline();
	}
} else {$maxpageno=1;}
?>
<br>
<!---Pages list begin-->
<table cellspacing=0 cellpadding=0 width=<?=$tablewidth?> align=center border=0 bgcolor=<?=$list_color1?>>
<form name=jump action=viewfav.php method=post>
<tr> 
<td align=left >&nbsp;
<?
echo "<b>当前第".$page."页  共".$maxpageno."页</b> ";
      $nextpage=$page+1;
      $previouspage=$page-1;
      if ($page>=2) echo "<a onfocus=this.blur()  href=\"viewfav.php?page=$previouspage\"><b>前页</b></a> ";
      else echo "<font color=#99ccff>前页</font></b> ";
      if ($page<=$maxpageno-1) echo "<a onfocus=this.blur()  href=\"viewfav.php?page=$nextpage\"><b>后页</b></a> ";
      else echo "<font color=#99ccff>后页</font> ";
echo "
  跳到<input type='text' name='page' size=4 maxlength=4 style='background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4' onMouseOver =\"this.style.backgroundColor = '#E5F0FF'\" onMouseOut = \"this.style.backgroundColor = ''\">页
<input type='submit' value='确 定' style='font-size: 9pt; height:18px;background-color:#f3f3f3;border:1 solid black' onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\" name='submit' onfocus=this.blur()>    <b>[ ".$perpage."篇/页 ]</b>
";
?>
</td></tr>
</form>
</table>
<!------Pages list end--->
<?
require("footer.php");echo"$footertp";
exit;
}
if($ofstarjob==add){

$newstring="$topic_name|$topic_author|$forumid|$filename|\n";

$favFile ="userdata/favorites/".$username.".txt"; 

if (file_exists($favFile)) //检查文件是否存在 
     { 
        $fp = fopen($favFile,"a"); 
	if (fwrite($fp,$newstring)) $echoInfo="成功收藏这个帖子";
		else $echoInfo="收藏这个帖子失败!";
	fclose($fp);
     } 
else 
     { 
       $fp = fopen($favFile,"w"); //建立文件 
	if (fwrite($fp,$newstring)) $echoInfo="成功收藏这个帖子";
		else $echoInfo="收藏这个帖子失败!";
	fclose($fp);
     } 

jump_page("viewfav.php",$echoInfo);
}
if($ofstarjob==del){
$favFile ="userdata/favorites/".$username.".txt"; 

if (file_exists($favFile)) {

	$fp=fopen($favFile,"r");
	flock($fp,LOCK_SH);
	$oldlist=file($favFile);
	fclose($fp);
    if ($filename=="all")
        {
          unlink($favFile);
             }
    else {
		$count=count($oldlist);
		for ($i=0; $i<$count; $i++) {
			$detail=explode("|",$oldlist[$i]);
			if ($detail[3]==$filename) {
					$oldlist[$i]="";
					break;
			}
		}
		$oldlist=implode("",$oldlist);
		writetofile($favFile,$oldlist);
          }

	jump_page("viewfav.php","执行成功");
  }
}
function articleline() {
global $a_info,$list_color1,$list_color2,$bordercolor,$username,$tablewidth,$read_perpage;

list($title,$author,$forumid,$filename)=explode("|",$a_info);

$viewauthor=$author;

if ($username==$author) 
  $stats="img src='images/mytopicnew.gif'";
else
  $stats="img src='images/topicnew.gif'";

$stats="<a onfocus=this.blur()  target=_blank href='read.php?forumid=$forumid&filename=$filename'><$stats alt=开新窗口浏览此主题 border=0></a>";

$title_back=$title;
if (strlen($title)>=61) $title=substr($title,0,58)."...";
$title=str_replace('%a%','<img src="images/addon.gif" border=0>',$title);
$title="<a onfocus=this.blur() cronym title=\"$title_back\"><a onfocus=this.blur()  href='read.php?forumid=$forumid&filename=$filename'\">$title</a></acronym>";


$forumlist=file('bbsdata/forumdata.php');
$count=count($forumlist);
for ($i=0; $i<$count; $i++) {
  $detail=explode('|',$forumlist[$i]);
  if ($detail[3]==$forumid) {$forumInfo=$detail[1]; break; }
}
print ("
<table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=1 bordercolor=$bordercolor>
<tr align=center height=25 bgcolor=$list_color1>
<td width=32>$stats</td>
<td width=* bgcolor=$list_color2 align=left>&nbsp;&nbsp;<a onfocus=this.blur() cronym title=\"$des\">$title</acronym>$multipage</td>
<td width=120 ><a onfocus=this.blur()  href=\"profile.php?job=show&target=$author\">$viewauthor</a></td>
<td width=160 bgcolor=$list_color2 ><a onfocus=this.blur()  href=\"thread.php?forumid=$forumid\">$forumInfo</a></td>
<td width=50 ><a onfocus=this.blur()  href=\"viewfav.php?ofstarjob=del&filename=$filename\">[删 除]</a></td>
</tr>
</table>
");
}
//---------Display the Error Message Table-------------------
function print_err() {
global $status;
msg_box("发生错误","帖子收藏程式发生了错误,情况:<br><br>$status<br><ul><li><a onfocus=this.blur()  href='javascript:history.back(1)'>返回前一页</a></li></ul>");
}
//+-----------
?>


⌨️ 快捷键说明

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