www.pudn.com > smartstarwap.rar > admin_news.php, change:2005-10-04,size:3695b


<? 
    /* ====================================== 
	 * ******smartstar firm wap system****** 
	 * ====================================== 
	 * AUTHOR : 
     * ======= 
     * Copyright (C) 2006 Wap-system - A wap system designed for firm 
     * by smartstar. 
	 */ 
?> 
<? 
include("function.inc.php"); 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<link href=js/common.css rel=stylesheet type=text/css> 
<title>管理内容</title></head> 
<body> 
<SCRIPT language=javascript> 
function unselectall() 
{ 
    if(document.myform.chkAll.checked){ 
	document.myform.chkAll.checked = document.myform.chkAll.checked&0; 
    } 	 
} 
 
function CheckAll(form) 
  { 
  for (var i=0;i<form.elements.length;i++) 
    { 
    var e = form.elements[i]; 
    if (e.Name != "chkAll"&&e.disabled==false) 
       e.checked = form.chkAll.checked; 
    } 
  } 
   
 
function ConfirmDel() 
{ 
	if(document.myform.Action.value=="Delall") 
	{ 
		if(confirm("确定要删除选中的内容吗?一但删除将无法恢复!")) 
		    return true; 
		else 
			return false; 
	} 
} 
</SCRIPT> 
<table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#DEDFDE"> 
  <form name="myform" type="get" action="del_news.php" onsubmit="return ConfirmDel();"><tr> 
    <td width="40" bgcolor="#F7F7F7"><div align="center"><strong>选中</strong> 
       
       
    </div></td> 
    <td bgcolor="#F7F7F7"><div align="center"><strong>内容标题</strong></div></td> 
    <td bgcolor="#F7F7F7"><div align="center"><strong>修改</strong></div></td> 
    <td bgcolor="#F7F7F7"><div align="center"><strong>删除</strong></div></td> 
  </tr> 
<? 
   include("../db_connect.php"); 
      include("../chinese/class.Chinese.php"); 
	  include("../config.php"); 
		if(!isset($offset)) 
	{ 
		$offset=0; 
 
	} 
	else 
	{ 
			if (empty($offset))  
	{  
		$offset=0;  
	} 
	if($offset >= 0) 
		{ 
		$offset=$_GET['offset']; 
		} 
	} 
	$offset=intval($offset); 
    $result=mysql_query("select * from wap_news order by id asc limit $offset,$limitn",$db) or die ("query failed"); 
	$num_result=mysql_query("select * from wap_news order by id asc",$db) or die ("query failed"); 
    $num=mysql_num_rows($num_result); 
	if($num==0) 
	   { 
?> 
<tr><td colspan='6' bgcolor='#FFFFFF'><div align='center'>暂无任何内容!</div></td></tr></form></table> 
<? 
	   } 
	   else if($num>0 && $num<=$limitn) 
	   { 
	include("display_news.php"); 
	   } 
	   else if($num>$limitn) 
	   { 
	include("display_news.php"); 
	if ($offset >= $limitn)  
	{  
		$prevoffset = $offset - $limitn;  
		echo "[<b><a href=\"admin_news.php?offset=0\">首页</a></b>]"; 
		print "[<b><a href=\"admin_news.php?offset=$prevoffset\">上一页</a></b>]";  
	} 
  
	$pages=intval($num/$limitn);  
 
	if ($pages < ($num/$limitn)) 
	{  
		$pages=($pages + 1);  
	} 
	if (! ( ($offset/$limitn) == ($pages - 1) ) && ($pages != 1) )  
	{  
		$newoffset = $offset+$limitn;  
		$last=$limitn*($pages-1); 
		print "[ <b><a href=\"admin_news.php?offset=$newoffset\">下一页</a></b>]";  
		print "[ <b><a href=\"admin_news.php?offset=$last\">尾页</a></b>]"; 
	} 
	  
	$j = ($offset/$limitn) + 1; 
	echo "转到"; 
	echo "<select name=\"select\" onchange=\"javascript:window.location=this.options[this.selectedIndex].value;\">\n"; 
	echo "<option selected>页码</option>"; 
	for ($i = 1; $i <= $pages; $i++)  
	{  
		$newoffset = $limitn*($i-1);  
		print "<option value=\"admin_news.php?offset=$newoffset\">[ $i ]</option>";  
	}  
	echo "</select>页\n"; 
	//show next if not last  
?> 
	</div></td> 
  </tr></table> 
<? 
	   } 
	mysql_close($db); 
	   
?> 
</td></tr></form> 
</table></body></html>