vBulletin论坛的[首页最新发表] 的hack
前言:其实我有点舍不得!呵呵,但是一想这里都是好兄弟么,呵呵,就算啦,发表发表拉 

hack名称:最新发表 
动机:我想每个有主页的vb用户都需要的... 
过程:初次写hack,比较累,也许写的也比较傻里傻气,好在最后功能应该达到了。 
要求:直接在主页上面用include ("/path/to/news.php3");即可。 


以下文件存成new.php3,保存在你的vbulletin的目录下面即可。 

<?php
//vBulletin最新发表hack
//版权:drin [email protected] http://www.youhow.com
//你可以随便的修改和散发,但是请不要用于商业目的。
//我将保留诉诸法律的权利。
//请不要删除版权信息。
//Powered by YOuHOw.COm 友好校园,瓦哈哈。
$database="database";
$host="localhost";
$user="root";
$password="";
$selfimage="path/to/your/image";//这张图片会出现在每个贴子的开头
$bbspath="path/to/your/bbs/";//最后有一个“/”
//----------------------------------------------------------------------------
//以下不要修改
//----------------------------------------------------------------------------
mysql_connect("$host","$user","$password");
$query=mysql_db_query("$database","SELECT * FROM post ORDER BY postid DESC");
$row mysql_fetch_array($query);
$number=$row[postid];

for (
$i=$number;$i>=$number-5;$i--)
  {
    
$result=mysql_db_query("$database","SELECT * FROM post where postid='$i'");
    
$row mysql_fetch_array($result);
    
$post_dateline=$row["dateline"];

    
$userid=$row["userid"]."<br>";
    
$result2=mysql_db_query("$database","SELECT * FROM user where userid='$userid'");
    
$row2 mysql_fetch_array($result2);
    
$username=$row2["username"];

    
$threadid=$row["threadid"];
    
$result1=mysql_db_query("$database","SELECT * FROM thread where threadid='$threadid'");
    
$row1 mysql_fetch_array($result1);
    
$thread_dateline=$row1["dateline"];

    if (
$thread_dateline==$post_dateline
    {
    
$cat="新贴  ";
    
$head="";
    }
    else
    {
    
$cat="回复  ";
      if (
$row["title"]=="")
      {
      
$head="";
      }
      else
      {
      
$head="<br>主题  ".$row["title"];
      }
    }

    
$iconid=$row["iconid"];
    
$result3=mysql_db_query("$database","SELECT * FROM icon where iconid='$iconid'");
    
$row3 mysql_fetch_array($result3);
    
$iconpath=$row3["iconpath"];
    if (
$iconpath==""$iconpath="images/icons/icon1.gif";
    
$icontitle=$row3["title"];
    if (
$icontitle=="")
    {
    
$icontitle=$row3["title"];
    }
    else
    {
    
$icontitle=$row3["title"]."地 ";
    }

    
$postdate=date("20y年m月d日 h:m:s",$row["dateline"]);

    
$pagetext=$row["pagetext"];
    
$len=strlen($pagetext);
    
$moretext="...&nbsp;[<a href='".$bbspath."showthread.php3?threadid=".$threadid."'>详文</a>]";
    if (
$len "200")
    {
    
$pagetext=substr($pagetext,"0","200").$moretext;
    }
    else
    {
    
$len=intval($len/2);
#       if ($len/2 != intval($len/2)) $len=$len-1; //保证$len为偶数
    
$pagetext=substr($pagetext,"0",$len).$moretext;
    }
    echo 
"<img src='".$selfimage."' border=0> <a href='".$bbspath."showthread.php3?threadid=".$threadid."'>第".$row["postid"]."张贴子</a><br>";
    echo 
"在<font color='#808080'>".$postdate."</font><br>"."<b><font face='arial0'>".$username."</font></b> ".$icontitle;
    echo 
$cat.$row1["title"].$head."<br>";
    echo 
"<img src='".$bbspath.$iconpath."' border=0> ".$pagetext."<hr color='#f0f0f0'>";
    }
?>