<?php
error_reporting(0);
isset($_GET['uid'])?$guid=$_GET['uid']:$guid='admin';//获取会员的ID，否则默认为管理员ID
isset($_COOKIE['username'])?$username=$_COOKIE['username']:$username=null;//获取会员的账号
isset($_GET['fl'])?$flid=$_GET['fl']:$flid="1";
require_once("core/setting.php");
require_once("config.php");
?>
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="style/mobindex8.css" rel="stylesheet" />
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/index.js"></script>
</head>
<title><?php echo $setting['title'];?></title>
<div id="head">
<div class="logo"><?php echo $setting['title'];?></div>
<?php
if($username==null){
    echo '<div class="login"><a href="login.php">登录</a> | <a href="reg.php">注册</a> </div>';
}else{
    echo '<div class="login"><a href="menber.php">返回会员中心</a></div>';
}
?>
</div>
<div id="head2">
<ul>
<?php
$fenleisql ="select * from dunling_menu order by id asc";
$fenleiery = mysql_query($fenleisql,$config);

$floneidfe = mysql_fetch_array($fenleiery);
$floneid = $floneidfe['id'];
isset($_GET['fl'])?$flid=$_GET['fl']:$flid=$floneid;

$flnum = mysql_num_rows($fenleiery);
$fenleisql ="select * from dunling_menu order by id asc limit 0,5";
$fenleiery = mysql_query($fenleisql,$config);
while($fl = mysql_fetch_array($fenleiery)){
    $liid = $fl['id'];
    if($liid==$flid){
      echo '<li class="hov">';  
    }else{
    echo '<li>';
    }
    echo '<a href="index.php?fl='.$fl['id'].'&uid='.$guid.'">';
    echo $fl['menu'];
    echo '</a></li>';
}
$rflsql = "select * from dunling_menu where id < '$flid'";
$rflery = mysql_query($rflsql,$config);
$rflnum = mysql_num_rows($rflery);
if($rflnum>"5"){
$fenleinamessql ="select * from dunling_menu where id='$flid'";
$fenleinameery = mysql_query($fenleinamessql,$config);
$flname = mysql_fetch_array($fenleinameery);
echo '<li class="hov"><a>'.$flname['menu'].'</a></li>';
}
if($flnum>"5"){
echo '<li class="menu_x"><img src="images/menus.png" /></li>';
}
?>
</ul>
</div>

<?php
if($flnum>"5"){
echo '<div id="head3_bao">';
echo '<div id="head3">';
echo '<ul>';
$fenleisql ="select * from dunling_menu order by id asc limit 5,$flnum";
$fenleiery = mysql_query($fenleisql,$config);
while($fl = mysql_fetch_array($fenleiery)){
    echo '<li>';
    echo '<a href="index.php?fl='.$fl['id'].'&uid='.$guid.'">';
    echo $fl['menu'];
    echo '</a></li>';
}
    echo '</ul></div></div>';
    }
?>
<div id="main">
<?php
ini_set("date.timezone","PRC");
isset($_GET['page'])?$page=$_GET['page']:$page="1";
$m="8";
$numsql = "select * from dunling_article where fenlei='$flid' ";
$numery = mysql_query($numsql,$config);
$lognum = mysql_num_rows($numery);
$zy = (int)(($lognum-1)/$m)+1;
$one = (int)($page-1)*$m;
$new = "select * from dunling_article where fenlei='$flid' order by id desc limit $one,$m ";
$article = mysql_query($new,$config);
while($l = mysql_fetch_array($article))
{
$date = $l['datetime'];
$date = date('m-d H:i',$date); 
$title = $l['title'];
$title = strip_tags($title);
$urlid = 'a/?read='.$l['urlid'].'_'.$guid;
$title = mb_substr($title,0,30,'UTF-8');
$img = $l['img'];
if(strlen($img)<"10"){
    $img = "images/dunling.jpg";
}
echo '<div class="word" onclick="location.href=\''.$urlid.'\'">';
echo '<div class="left"><img src="'.$img.'"/></div>';
echo '<div class="right">';
echo '<div class="title">'.$title.'</div>';
echo '</div>';
echo '</div>';
}
mysql_close();
?>
</div>
<?php
if($page>=$zy){
    $xiayiye = $zy;
    $block = "disabled";
    $bvalue ="已到最后一页";
}else{
    $block = null;
    $xiayiye = $page+1;
    $bvalue = "下一页 &raquo;";
}
$shangyiye = $page-1;
?>
<div id="pageinfo">
共&nbsp;<?php echo $zy;?>&nbsp;页&nbsp;|&nbsp;当前在第&nbsp;<?php echo $page;?>&nbsp;页&nbsp;&nbsp;
<?php
if($page>"1"){
  echo '<a href="?page='.$shangyiye.'&uid='.$guid.'">上一页</a>';  
}
?>
</div>
<div id="page">
<input <?php echo $block;?> onclick="location.href='?page=<?php echo $xiayiye;?>&uid=<?php echo $guid;?>'" type="button" value="<?php echo $bvalue;?>" />
</div>
<div id="bottom">版权所有&copy;2015 <?php echo $setting['title'];?></div>

<div style="display: none;"><?php echo stripslashes(file_get_contents("core/tjcode.dll"));?></div>