<?php
$bt="流年时刻";
include("../conn.php");
include("../head.php");
include_once("../function.php");
$sid = sqlstr($_COOKIE['dl']);
$uin=mysql_fetch_array(mysql_query("select * from user where sid='$sid'"));
$id=$uin['id'];
$diary=mysql_num_rows(mysql_query("SELECT * FROM diary"));
$user=mysql_num_rows(mysql_query("SELECT * FROM user"));
$now=date("Y年m月d日 H时i分");

echo <<<htm
<div class="hui"><div class="zuo"><a href="/m/diary/">日记</a>　<a href="/m/one">ONE</a></div><div class="you">流年时刻 | <a href="diandi.php">点滴</a></div></div>
<div id="main"><div class="listyou"> 你的痕迹，似水流年，消逝不见<br/>(这里显示了那些公开的)</div></div>
htm;

$max=mysql_num_rows(mysql_query("SELECT * FROM diary WHERE diaryzz='1'"));
$p=ceil($max/30);
if(!$page or $page>$p){
$page=1;
}
$low=30*($page-1);//开始查询的条数
$pagesize=30;//每页查询的条数
$rs=mysql_query("SELECT * FROM diary WHERE diaryzz='1' ORDER BY diarytime DESC LIMIT {$low},{$pagesize}");//列出最新公开的日记


while($uinfo=mysql_fetch_array($rs)){
$writeid=$uinfo['diarywriteid'];
$ytime=ytime($uinfo['diarytime']);
$htime=htime($uinfo['diarytime']); 
$wtime=wtime($uinfo[diarytime]);
$uina=mysql_fetch_array(mysql_query("select * from user where id='$writeid'"));
$uiname=$uina["name"];
echo '<div id="main"><div class="youlist"> <a href="/m/user/?'.$writeid.'">'.$uiname.'</a> <div class="time">'.$ytime.' '.$wtime.'</div></div><div class="time">'.$htime.'</div><p>'.$uinfo["diarytxt"].'</p></div>';

}

if($max){
echo '<br/><br/><div class="youlist"> </div><center>MORE......<br/>'.$now.'<br/>已经为'.$user.'人珍藏了'.$diary.'篇日记</center><div class="hui"><div class=zuo>这里显示了那些公开的</div><div class="you"><a href="#C1">顶部</a></div></div>';
}else{
echo "<br/><br/><font color=red>还没有人写字记</font><br/><br/>　　其实生活中值得我们去记录的东西有很多，只是那一份静下心来写字记的宁静最难得。<br/><br/>";
}

?>

<?php include("../footer.php"); ?>