<?
//-----------------------------------------------------------------------------
//    ID002同学录 单班级 (PHP & MySQL) 1.0 标准版
//-----------------------------------------------------------------------------
//    Copyright(C) aNErG, 2003. All rights reserved
//
//    技术支持 http://anerg.126.com
//-----------------------------------------------------------------------------
//    本软件对个人完全免费使用
//
//    如用于商业用途,您必须与我联系并支付RMB ￥20
//-----------------------------------------------------------------------------
 if (empty($HTTP_COOKIE_VARS["class_username"]))
{echo "请先<a herf=index.php>登录</a>！";exit;}?>
<? include ('conn.php');
require('java.js');
$query="select count(*) from photomsg";
$result=mysql_db_query("$dbname",$query);
$arr=mysql_fetch_array($result);
$num=$arr["count(*)"];
if (($num/20)-intval($num/20)==0){$num2=$num/20;}
else{
$num2=intval($num/20)+1;}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>班级相册</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body>
<div align="center">
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="50%">
<div align="right"><strong>班&nbsp;级&nbsp;</strong></div></td>
      <td width="50%"><strong>像&nbsp;册</strong></td>
    </tr>
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%">--记住我们的永远</td>
    </tr>

  </table>

<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#7597B0">

  <tr>
      <td>
	  
	  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
	  <?
	  if(!$result){echo "还没有内容";}
	  if(empty($offset)){$offset=0;}
	  echo"<tr>";
	  $query="SELECT photoid,photourl,photoname,author,uptime FROM photomsg ORDER BY photoid DESC LIMIT $offset,20";
      $result=mysql_db_query("$dbname",$query);
	  $i=1;
	  while($r=mysql_fetch_array($result))
      {
	   $photourl=$r["photourl"];
       $photoname=$r["photoname"];
	   $author=$r["author"];
       $uptime=$r["uptime"];
	   $photoid=$r["photoid"];
	   echo "<td><div align='center'><a href=\"###\" onclick=\"Popup('showphoto.php?photoid=$photoid','$photoid',750,550);\">
	   <img src=$photourl height=80 width=120 border='0'></a><br>
	   $author 上传于<br> $uptime</div></td>";
	  $i++;
	  if($i>=6){
	  echo"</tr>";
	  $i=1;
	  } 
	   }
	  ?>
	  </table>
	  <div align="center">
	  <?	if($offset!=0){
	$page_up=$offset-20;
	echo"<a href=$PHP_SELF?offset=$page_up>上一页</a>";
	}
	if($offset+20<$num){
	$page_next=$offset+20;
	echo"<a href=$PHP_SELF?offset=$page_next>下一页</a>";}
    ?></div>
	  </td>
	    </tr>
  </table>
  <?php require("bottom.php"); ?>