<?php 
session_start();
include "Conn/conn.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>林少龙个人空间</title>
<link href="CSS/style.css" rel="stylesheet"/>
</head>
<?php
$str=array("0","1","2","3","4","5","6","7","8","9");
$word=strlen($str);
for($i=0;$i<4;$i++){
$num=rand(0,$word*2-1);      //$word=$word*2-1
$img=$img."<img src=' images/checkcode/".$num.".jpg' width='16' height='16'>";    //显示随机图片
$pic=$pic.$str[$num];    //将图片转换成数组中的文字
}
?>
<script src="JS/check.js" ></script>
<body onselectstart="return false">
<table width="750"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="right" valign="top">
    <td height="170" colspan="2" background="images/solo.jpg">
  <table width="100%" height="149"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="51" align="right">
  <br>
  <table width="262" border="0" cellspacing="0" cellpadding="0">
            <tr align="left">
              <td width="26" height="20"><a href="index.php"></a></td>
              <td width="71" class="word_white"><a href="index.php"><span style="FONT-SIZE: 9pt; COLOR: #000000; TEXT-DECORATION: none">首  页</span></a></td>
              <td width="87"><a href="index.php"><span  style="FONT-SIZE: 9pt; COLOR: #000000; TEXT-DECORATION: none">我的空间</span></a></td>
              <td width="55"><a href="<?php echo (!isset($_SESSION[username])?'Register.php':'safe.php'); ?>"><span style="FONT-SIZE: 9pt; COLOR: #000000; TEXT-DECORATION: none"><?php echo (!isset($_SESSION[username])?"访客注册":"安全退出"); ?></span></a></td>
              <td width="23">&nbsp;</td>
            </tr>
          </table>
  <br></td>
        </tr>
        <tr>
          <td height="66" align="right">&nbsp;</td>
        </tr>
        <tr>
<form name="form" method="post" action="checkuser.php">
          <td height="20" valign="baseline">
            <table width="780"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="32%" height="20" align="center" valign="baseline">&nbsp; </td>
                <td width="67%" align="left" valign="baseline" style=" text-indent:10px;">
<?php
   if(!isset($_SESSION[username])){
  ?>
用户名:
                  <input  name=txt_user size="10">
密码:
<input  name=txt_pwd type=password style="FONT-SIZE: 9pt; WIDTH: 65px" size="6">
验证码:
<input name="txt_yan" style="FONT-SIZE: 9pt; WIDTH: 65px" size="8">
<input type="hidden" name="txt_hyan" id="txt_hyan" value="<?php echo $pic;?>">
<?php echo $img; ?> <input style="FONT-SIZE: 9pt"  type=submit value=登录 name=sub_dl onClick="return f_check(form)">&nbsp;&nbsp; 
<?php
}else{
?>
<font color="red"><?php echo $_SESSION[username]; ?></font>&nbsp;&nbsp;林少龙个人空间欢迎您的光临!!!当前时间:<font color="red"><?php echo date("Y-m-d l"); ?>
</font>
<?
}
?>
</td>
                <td width="1%" align="center" valign="baseline">&nbsp;</td>
              </tr>
            </table> 
</td>
  </form>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td width="236" height="501" background=" images/">
<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
<td align="center"><strong>林少龙的最新文章:</strong></td>
  </tr>
  <tr>
<td height="125" align="center" valign="top"><br>

  <table width="200"  border="0" cellspacing="0" cellpadding="0">
<tr>
  <td><table width="201"  border="0" cellspacing="0" cellpadding="0" valign="top" style="margin-top:5px;">
<?php
$sql=mysql_query("select id,title from tb_article order by now desc limit 5");
$i=1;
while($info=mysql_fetch_array($sql)){
?>
<tr>
  <td width="201" align="left" valign="top">
&nbsp;&nbsp;&nbsp;<a href="wenzhang.php?file_id=<?php echo $info[id];?>" target="_blank"><?php echo $i."、".substr($info[title],0,20);?></a>
  </td>
</tr>
<?php 
$i=$i+1;
  }
  ?>
<tr>
  <td height="10" align="right"><a href="file_more.php">&nbsp;&nbsp;&nbsp;</a></td>
</tr>
  </table></td>
</tr>
</table></td></tr>
  <tr>
<td height="201" align="center" valign="top"><strong>林少龙的最新图片:</strong><br>
  <table width="145"  border="0" cellspacing="0" cellpadding="0">
  <tr>
<td><table width="201"  border="0" cellspacing="0" cellpadding="0" valign="top" style="margin-top:10px;">
<?php
$sql=mysql_query("select id,tpmc,file from tb_tpsc order by scsj desc limit 2");
while($info=mysql_fetch_array($sql)){
?>
<tr>
  <td width="9" rowspan="2"  align="center">&nbsp;                                        </td>
  <td width="147"  align="center"><a href="image.php?recid=<?php echo $info[id]; ?>" target="_blank"><img src="f_image.php?pic_id=<?php echo $info[id];?>"  width="120" height="120" border="0"></a>                                                            </td>
  <td width="10" rowspan="2"  align="center">&nbsp;</td>
</tr>
<tr>
  <td  align="center">图片名称:<?php echo $info[tpmc];?></td>
</tr>
<?php 
  }
  ?>
   <tr>
  <td colspan="3" height="10" align="right"><a href="pic_more.php">&nbsp;&nbsp;&nbsp;</a></td>
</tr>
</table></td>
  </tr>
</table>        </td>
  </tr>
</table>
</td>
    <td width="521" height="501" align="center" background="images/">
<table width="100%" height="98%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><TABLE style="WIDTH: 580px" VERTICAL-ALIGN: text-top; cellSpacing=0 cellPadding=0 align="center">
          <TBODY>
            <TR align="center" valign="middle">
              <TD style="WIDTH: 100px; COLOR: red;">欢迎您:&nbsp;<?php echo $_SESSION[username]; ?>&nbsp;&nbsp;</TD>
            <TD style="WIDTH: 80px; COLOR: red;"><SPAN  style="FONT-SIZE: 9pt; COLOR: #cc0033"> </SPAN><a href="index.php">空间首页</a></TD>
                      <TD style="WIDTH: 80px; COLOR: red;"><a href="add_wenzhang.php">文章管理</a></TD>
                      <TD style="WIDTH: 80px; COLOR: red;"><a href="browse_pic.php">图片管理</a></TD>
              <?php
  if($_SESSION[fig]==1){
   ?>
              <?php  
  }
  ?>
              <TD style="WIDTH: 80px; COLOR: red;"><a href="safe.php">退出登录</a></TD>
            </TR>
          </TBODY>
        </TABLE></td>
      </tr>
      <tr>
        <td height="372" align="center">

<table width="90%" height="100%"  border="0" cellpadding="0" cellspacing="0" style="margin-top:25px;">
          <tr>
            <td height="130" align="center" valign="top"><?php if ($page=="") {$page=1;}; ?>
<table width="80%" border="1" align="center" cellpadding="3" cellspacing="1" bordercolor="##C1CDCD" bgcolor="#FFFFFF">
                <tr align="left" colspan="2" >
                  <td height="25" colspan="3" valign="top" bgcolor="#EFF7DE"> <span class="tableBorder_LTR"> 查看文章 </span> </td>
                </tr>
                 <?php
if ($page){
   $page_size=20;     //每页显示20条记录
   $query="select count(*) as total from tb_article order by id desc";   
$result=mysql_query($query);       //查询总的记录条数
$message_count=mysql_result($result,0,"total");       //为变量赋值
$page_count=ceil($message_count/$page_size);   //根据记录总数除以每页显示的记录数求出所分的页数
$offset=($page-1)*$page_size; //计算下一页从第几条数据开始循环  
for ($i=1; $i<2; $i++) {         //计算每页显示几行记录信息
if ($i==1) {
$sql=mysql_query("select id,title from tb_article order by id desc limit $offset, $page_size");
}
 ?>
                <tr>
                  <td height="31" align="left" valign="middle" ><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="left" valign="middle"><table border="0" cellspacing="0" cellpadding="0" valign="top">
                          <?php
$i=1;
while($info=mysql_fetch_array($sql)){
  ?>
                          <tr>
                            <td align="left" valign="middle"> &nbsp;&nbsp;&nbsp;<a href="wenzhang.php?file_id=<?php echo $info[id];?>"><?php echo $i."、".$info[title];?></a> </td>
                          </tr>
                          <?php 
  $i=$i+1;
  }
  ?>
                      </table></td>
                    </tr>
                  </table></td>
                </tr>
                <?php
}while($result=mysql_fetch_array($sql));
?>
              </table>
              <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr bgcolor="#EFF7DE">
                  <td width="73%" align="left" valign="middle">&nbsp;&nbsp;页次:<?php echo $page;?>/<?php echo $page_count;?>页
                    记录:<?php echo $message_count;?> 条&nbsp; </td>
                  <td width="27%" align="right" class="hongse01">
                          <?php
  if($page!=1)
   {
 echo  "<a href=file_more.php?page=1>首页</a>&nbsp;";
 echo "<a href=file_more.php?page=".($page-1).">上一页</a>&nbsp;";
   }
  if($page<$page_count)
   {
echo "<a href=file_more.php?page=".($page+1).">下一页</a>&nbsp;";
echo  "<a href=file_more.php?page=".$page_count.">尾页</a>";
   }
 } 
?>                  </td>
                </tr>
              </table></td>
          </tr>
        </table></td>
          </tr>
        </table>


</td>
      </tr>
      <tr>
        <td height="66">&nbsp;</td>
      </tr>
    </table>
</td>
  </tr>
</table>
</body>
</html>