——此文章摘自《完全手册PHP网络开发详解》定价
¥
特价
¥
详细>>http://track
linktech
cn/?m_id=dangdang&a_id=A
&l=
&l_type
=
width=
height=
border=
nosave>
文章管理页面主要实现对文章的修改删除和审核操作这里通过JavaScript代码实现对删除和审核的确认其代码如下所示
<a onClick=javascript:return confirm(确认要删除吗?) href=admin_delete php?article_id=<?php echo $row_rs_articles[article_id]; ?>>删除</a>
首先需要显示所有文章的列表其代码如下所示
<?php require_once(Connections/connphp); ?>
<?php
$currentPage = $_SERVER[PHP_SELF];
$maxRows_rs_articles = ;
$pageNum_rs_articles = ;
if (isset($_GET[pageNum_rs_articles]))
{
$pageNum_rs_articles = $_GET[pageNum_rs_articles];
}
$startRow_rs_articles = $pageNum_rs_articles * $maxRows_rs_articles;
mysql_select_db($database_conn $conn);
$query_rs_articles = SELECT * FROM articles ORDER BY article_id DESC;
$query_limit_rs_articles = sprintf(%s LIMIT %d %d $query_rs_articles
$startRow_rs_articles $maxRows_rs_articles);
$rs_articles = mysql_query($query_limit_rs_articles $conn) or die(mysql_ error());
$row_rs_articles = mysql_fetch_assoc($rs_articles);
if (isset($_GET[totalRows_rs_articles]))
{
$totalRows_rs_articles = $_GET[totalRows_rs_articles];
}
else
{
$all_rs_articles = mysql_query($query_rs_articles);
$totalRows_rs_articles = mysql_num_rows($all_rs_articles);
}
$totalPages_rs_articles = ceil($totalRows_rs_articles/$maxRows_rs_articles);
$queryString_rs_articles = ;
if (!empty($_SERVER[QUERY_STRING]))
{
$params = explode(& $_SERVER[QUERY_STRING]);
$newParams = array();
foreach ($params as $param)
{
if (stristr($param pageNum_rs_articles) == false &&
stristr($param totalRows_rs_articles) == false)
{
array_push($newParams $param);
}
}
if (count($newParams) != ) {
$queryString_rs_articles = & htmlentities(implode(& $newParams));
}
}
$queryString_rs_articles = sprintf(&totalRows_rs_articles=%d%s $totalRows_
rs_articles $queryString_rs_articles);
?>
<!DOCTYPE HTML PUBLIC //WC//DTD HTML Transitional//EN http://wwwworg/TR/html/loosedtd>
right>[] [http://developcsaicn/web/htm>] [http://developcsaicn/web/htm>] [http://developcsaicn/web/htm>] [http://developcsaicn/web/htm>]