<?
include(dirname(__FILE__)."/../global.php");




	//连接数据库
    include("../../../include/db.cfg.php");
	//连接数据库
	include("../../../include/cfg.php");
	include("../../../include/js.php");
	
@$job=$submitted_vars['job'];

$page_size  =  $admin_ns_page_size;

$web_sort_id  = $_GET['web_sort_id'];//网站栏目
$module_id    = $_GET['module_id'];//栏目模块


                  $query="SELECT * FROM `126jz_module` WHERE `module_id`='".$module_id."'";
                  $result=mysql_query($query);
                  $module_config       =  mysql_result($result,"0","module_config");
				  
				  $array = unserialize($module_config);
				  
				  foreach($array AS $key=>$rs){
				  $show_title[] = $rs['title'];
				  $show_field_id[] = $rs['field_id'];
				  }


function writetofile($filename,$book)
{
$fd=fopen("$filename","w");
fwrite($fd,$book);
fclose($fd);
return true;
}

  $text ="
  \$show1     = stripslashes( \$row['".$show_field_id['0']."'] );
  \$show2     = stripslashes( \$row['".$show_field_id['1']."'] );
  \$show3     = stripslashes( \$row['".$show_field_id['2']."'] );";

$text = "<?php\n$text";
writetofile("./cache.php","$text");

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="98%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#A4B6D7" class="font">
  <tr align="center" background="../../images/titlebg.jpg" class="font_title">
    <td height="25" background="../../images/titlebg.jpg">操&nbsp;&nbsp;作</td>
    <td height="25" background="../../images/titlebg.jpg">排序</td>
    <td background="../../images/titlebg.jpg"><?=$show_title['0']?></td>
    <td height="25" background="../../images/titlebg.jpg"><?=$show_title['1']?></td>
    <td height="25" background="../../images/titlebg.jpg"><?=$show_title['2']?></td>
  </tr>
  <?
if( $job == "search" ){
	  $search_title = $submitted_vars["search_title"];
	  $query="SELECT * FROM `126jz_module_content_$module_id` WHERE `title` LIKE '%".$search_title."%'";
}else{
$query="SELECT * FROM `126jz_module_content_$module_id`";
}

//echo "<br>".$query."<br><br><br><br>aaaa<br><br><br><br>";
$result=mysql_query($query);
$num=mysql_num_rows($result);

$curr_page = isset($_GET['curr_page']) ? $_GET['curr_page'] : 1;  //当前页
			
  $query=$query." ORDER BY `id` DESC  LIMIT ".(($curr_page-1)*$page_size)." , $page_size ";
  //echo $query;
  $result=mysql_query($query);
  $i=0;
  while($row=mysql_fetch_array($result))
  {
  
  $id        = stripslashes($row["id"]);
  $content_list     = stripslashes( $row["content_list"] );
  $module_id      = stripslashes( $row["module_id"] );
  $web_sort_id     = stripslashes( $row["web_sort_id"] );

  include("./cache.php");
                ?>
  <tr>
    <td width="8%" height="14" align="center" bgcolor="#FFFFFF"><a href="modify.php?id=<?=$id?>"><img src="../../images/button_edit.gif" alt="编辑" width="12" height="13" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="del.php?id=<?=$id?>" onclick="return MM_popupMsg('确定要删除吗！！')"><img src="../../images/button_drop.gif" alt="删除" width="11" height="13" border="0" /></a></td>
    <td width="7%" align="center" bgcolor="#FFFFFF"><input name="content_list" type="text" id="content_list" value="<?=$content_list?>" size="4" /></td>
    <td width="53%" align="left" bgcolor="#FFFFFF"><?=$show1?></td>
    <td width="20%" align="center" bgcolor="#FFFFFF"><?=$show2?></td>
    <td width="12%" align="center" bgcolor="#FFFFFF"><?=$show3?></td>
  </tr>
  <?
	$i++;
	}
	?>
  <tr>
    <td height="15" colspan="5" align="center" bgcolor="#FFFFFF"><table width="78%" height="30" border="0" cellpadding="0" cellspacing="0" class="font">
      <tr>
        <td width="39%"><?
#############################  url　勤的传递值　###################################

		$url = "";
		
		if( $job == "search" ){

		$url = "job=$job&search_title=$search_title";

		}

#############################  url　勤的传递值　###################################
		  
                                                
                                 $total_page = ceil($num / $page_size);   //总页数
                        ?>
          页次：<? echo $curr_page.'/'.$total_page; ?>&nbsp;&nbsp;&nbsp;&nbsp;共<? echo $num;?>篇&nbsp;&nbsp;每页<? echo $page_size;?>篇</td>
        <td width="35%"><p align="center"> <a title="首页" href="?curr_page=1&amp;<?=$url?>"> <font face="Webdings">9</font></a>&nbsp;
                  <?
                                                if ( $curr_page > 1 )
                                echo "<a title=上一页 href='?curr_page=".($curr_page-1)."&$url'>";
                                                ?>
                  <font face="Webdings">7</font>
                  <?
                                                if ( $curr_page > 1 )
                                echo "</a>";
                                                ?>
          &nbsp;<font color="#ff0000"><? echo "[".$curr_page."]"; ?></font>&nbsp;
          <?
                                                if ( $curr_page <$total_page )
                                echo "<a title=下一页 href='?curr_page=".($curr_page+1)."&$url'>";
                                                ?>
          <font face="Webdings">8</font>
          <?
                                                if ( $curr_page <$total_page )
                                echo "</a>";
                                                ?>
          &nbsp; <a title="末页" href="?curr_page=<? echo "$total_page" ?>&amp;<?=$url?>"> <font face="Webdings">:</font></a></p></td>
        <td width="8%">&nbsp;</td>
        <td width="18%" colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="23%"> 到 </td>
            <td width="42%"><?
echo "<SELECT
      onchange=\"window.location=('?$url&curr_page='+this.options[this.selectedIndex].value+'')\"
      name=oldname>";
for($i=1;$i<=$total_page;$i++){
echo "<option value=$i";
      if($curr_page==$i){
         echo " selected";
        }
echo ">$i</option>";
}
echo "</select>";
?>            </td>
            <td width="19%">页</td>
            <td width="16%">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
