<?php
include_once("inc/config.php");
include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/pageclass.php");
include_once("inc/ftcode.php");
include_once("conn.php");

$userid=intval($_GET["userid"]);
include_once("memberinfo.php");
?>
<html><head><meta http-equiv=content-type content="text/html; charset=utf-8>">
</head>
<script language="javascript" src="js/publicfun.js"></script>
<body>
<center>
<title><?=$username?>的个人相册</title>
<link rel="stylesheet" type="text/css" href="<?=$cssfile?>">
<link rel="stylesheet" type="text/css" href="blogcss/blogpage.css">
<?
include_once("usernav.php");
include_once("photohead.php");
?>
<div class="stage">
<div class="stagepad">
<div style="width:100%">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="modth">
	<tr><td class="modtl" width="7">&nbsp;</td>
	<td class="modtc" nowrap>
		<table border="0" cellspacing="0" cellpadding="0"><tr><td>
		<div class="modhead"><span class="modtit">相册列表</span> </div>
		</td></tr></table>
	</td>
	<td class="modtc" nowrap align="right"></td>
	<td class="modtr" width="7">&nbsp;</td>
	</tr></table>
<div class="modbox">
<div style="width:100%">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="modact">
	<tr>
<?
$p = new ft_page;
$sql="SELECT * FROM {$tablepre}ftbbs_upload WHERE (id IN(SELECT MAX(id) FROM {$tablepre}ftbbs_upload GROUP BY photo_name)) and (bbs_blog_type=1 or bbs_blog_type=2) and (sign=0 or sign=2) and clubuser_id=".$userid." order by indate desc";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);

$p->pvar="page"; 
$p->setvar(array("userid" => $userid));
$p->set(24,$numrows,$psize); 
$rsx=mysql_query($sql." limit ".$p->limit());
if ($numrows!=0){
  do {
  $i++;
  $userimg=$myrow["userimg"];
  $photourl=$myrow["upload_pic"];
  if ($photourl!=""){
     $photourl=$photourl;
	 }
  else{
     $photourl="blogimages/nophoto.gif";
  }
  $sign=$myrow["sign"]; 
  $str="select * from {$tablepre}ftbbs_upload where photo_name='".$myrow["photo_name"]."' and (bbs_blog_type=1 or bbs_blog_type=2) and clubuser_id=".$userid;
  $rx=mysql_query($str);
  $num = mysql_num_rows($rx);
?>
	<td align="center" valign="bottom" width="25%">
		<table border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td><img src="blogimages/pbtl.gif" border="0"></td>
		<td background="blogimages/pbtc.gif"></td>
		<td ><img src="blogimages/pbtr.gif" border="0"></td>
		</tr>
		<tr>
		  <td background="blogimages/pblc.gif"></td>
		  <td>
		<?
		if ($sign==2){
		?>
		  <a onClick=checkpwd('<?=$myrow["id"]?>','<?=$userid?>','<?=$myrow["photo_name"]?>') href="#"><img src="blogimages/pwdchk.gif" width="200" border="0"></a>
		<?
		}
		else{
		?>
		  <a href="disphoto.php?id=<?=$myrow["id"]?>&userid=<?=$userid?>&photo_name=<?=$myrow["photo_name"]?>"><img src="<?=$photourl?>" width="200" border="0"></a>
		<?
		}
		?>
		  </td>
		<td background="blogimages/pbrc.gif"></td>
		</tr>
		<tr>
		<td><img src="blogimages/pbbl.gif" border="0"></td>
		<td background="blogimages/pbbc.gif"></td>
		<td><img src="blogimages/pbbr.gif" border="0"></td>
		</tr>
		</table>
		<div class="tit">
		<?
		if ($sign==2){
		?>
		<a onClick=checkpwd('<?=$myrow["id"]?>','<?=$userid?>','<?=$myrow["photo_name"]?>') href="#"><?=$myrow["photo_name"]?></a>
		<?
		}
		else{
		?>
		<a href="disphoto.php?id=<?=$myrow["id"]?>&userid=<?=$userid?>&photo_name=<?=$myrow["photo_name"]?>"><?=$myrow["photo_name"]?></a>
		<?
		}
		?>
		<span class="count"><font color="#000000">(共<?=$num?>张)</font></span></div>	
	</td>
<?
  if ($i % 3==0){
  echo "<tr align=center>";
  }
}
 while ($myrow = mysql_fetch_array($rs));
?>
	</tr>
  <tr align=center> 
    <td colspan="15"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="modact">
                    <tr> 
                      <td width="77%"> 
                        <div align="center">
    <?
     $p->output(0);
     mysql_free_result($rs);
     mysql_free_result($rsx);
     $db->close(); 
    ?>
						</div>
        </tr>
      </table></td>
  </tr>
<? }else{?>
  <tr> 
              <td height="15" align=center class="f12"> <font color="#000000">记录为空!</font></td>
  </tr>
<? }?>
	</table>
</div>
</div>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" height="8">
	<tr><td class="modbl" width="7">&nbsp;</td>
	<td class="modbc">&nbsp;</td>
	<td class="modbr" width="7">&nbsp;</td>
	</tr></table>
</div>
</div>
</div>
</div>
<br><center>
<?
include_once("tail.php");
?>
</center>
</body></html>