<?php 
class linkstr{
  var $dbz;
  function linkstr($str){
    $this->dbz=$str;
  }
  
  //获取信息总数
  function linknum(){
    $i=0;
	$sql=query("select id from ".$this->dbz."link order by id asc");
	$i=rows($sql);
	return $i;
  }
  
  function linklist($start,$num,$page){
    $list='';
	$i=1;
    $sql=query("select * from ".$this->dbz."link order by orders asc limit ".$start.",".$num."");
	while($row=fetch($sql)){
	  if($row["imgs"]==''){$imgs='无';}else{$imgs="<img src='".$row["imgs"]."' />";}
	  if($row["audits"]=='0'){$audits="<a href=\"query.php?rel=link_audits&id=".$row["id"]."&num=1&page=$page\"><font color=red>未审核</font></a>";}else{$audits="<a href=\"query.php?rel=link_audits&id=".$row["id"]."&num=0&page=$page\">已审核</a>";}
	  
	  $list=$list."<tr align=\"center\">
	  <td  height=\"25\" bgcolor=\"#FFFFFF\"><input type=\"checkbox\" name=\"checkbox".$i."\" id=\"checkbox".$i."\" value=\"".$row["id"]."\" />".$row["id"]."</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"><a href=\"".$row["urls"]."\" target=\"_blank\">".$row["names"]."</a></td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"><a href=\"".$row["urls"]."\" target=\"_blank\">".$row["urls"]."</a></td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">$imgs</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">$audits</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"><A href=\"http://wpa.qq.com/msgrd?V=1&Uin=".$row["qqs"]."&Site=http://www.csc9.cn&Menu=yes\" target=blank>会话</A></td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\">".utf_substr($row["dis"],20)."</td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"><input type=\"text\" name=\"orders$i\" value=\"".$row["orders"]."\" size=4 /></td>
	  <td bgcolor=\"#FFFFFF\" align=\"left\"> <a href=\"link.php?rel=link_info&id=".$row["id"]."&page=$page\">修改</a> <a href=\"query.php?rel=link_del&id=".$row["id"]."&page=$page\">删除</a></td>
	  ";
	  $i=$i+1;
	}
	return $list;
  }
}
?>