<?php require_once('data/config.php'); ?><?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO `comment` (name, `date`, wzid, `comment`) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['pl_name'], "text"),
GetSQLValueString($_POST['pl_date'], "date"),
GetSQLValueString($_POST['pl_wzid'], "int"),
GetSQLValueString($_POST['pl_comment'], "text"));
mysql_select_db($database_config, $config);
$Result1 = mysql_query($insertSQL, $config) or die(mysql_error());
$insertGoTo = "chapter.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_chapter = 1;
$pageNum_chapter = 0;
if (isset($_GET['pageNum_chapter'])) {
$pageNum_chapter = $_GET['pageNum_chapter'];
}
$startRow_chapter = $pageNum_chapter * $maxRows_chapter;
$colname_chapter = "-1";
if (isset($_GET['id'])) {
$colname_chapter = $_GET['id'];
}
mysql_select_db($database_config, $config);
$query_chapter = sprintf("SELECT * FROM sls_wz WHERE id = %s", GetSQLValueString($colname_chapter, "int"));
$query_limit_chapter = sprintf("%s LIMIT %d, %d", $query_chapter, $startRow_chapter, $maxRows_chapter);
$chapter = mysql_query($query_limit_chapter, $config) or die(mysql_error());
$row_chapter = mysql_fetch_assoc($chapter);
if (isset($_GET['totalRows_chapter'])) {
$totalRows_chapter = $_GET['totalRows_chapter'];
} else {
$all_chapter = mysql_query($query_chapter);
$totalRows_chapter = mysql_num_rows($all_chapter);
}
$totalPages_chapter = ceil($totalRows_chapter/$maxRows_chapter)-1;
mysql_select_db($database_config, $config);
$query_system = "SELECT * FROM sls_system";
$system = mysql_query($query_system, $config) or die(mysql_error());
$row_system = mysql_fetch_assoc($system);
$totalRows_system = mysql_num_rows($system);
mysql_select_db($database_config, $config);
$query_new_mood = "SELECT * FROM sls_wz ORDER BY id DESC";
$new_mood = mysql_query($query_new_mood, $config) or die(mysql_error());
$row_new_mood = mysql_fetch_assoc($new_mood);
$totalRows_new_mood = mysql_num_rows($new_mood);
mysql_select_db($database_config, $config);
$query_new_chapter = "SELECT * FROM sls_wz ORDER BY id DESC";
$new_chapter = mysql_query($query_new_chapter, $config) or die(mysql_error());
$row_new_chapter = mysql_fetch_assoc($new_chapter);
$totalRows_new_chapter = mysql_num_rows($new_chapter);
$colname_pl = "-1";
if (isset($_GET['wzid'])) {
$colname_pl = $_GET['wzid'];
}
mysql_select_db($database_config, $config);
$wzid =$row_chapter['id'];//是你当前文章的编号
$query_pl = sprintf("SELECT * FROM `comment` WHERE wzid = $wzid ORDER BY id DESC", GetSQLValueString($colname_pl, "int"));
$pl = mysql_query($query_pl, $config) or die(mysql_error());
$row_pl = mysql_fetch_assoc($pl);
$totalRows_pl = mysql_num_rows($pl);
$queryString_chapter = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_chapter") == false &&
stristr($param, "totalRows_chapter") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_chapter = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_chapter = sprintf("&totalRows_chapter=%d%s", $totalRows_chapter, $queryString_chapter);
?>
<?php echo $row_chapter['name']; ?>—<?php echo $row_system['name']; ?>—<?php echo $row_system['Author']; ?>document.body.οnselect=document.body.οncοpy=document.body.οnmοuseup=function(){document.selection.empty();};
include "header.php"
?>
<?php echo $row_chapter['name']; ?>
分享到: | <?php echo $row_chapter['date']; ?>更新 |
$cid =$row_chapter['id'];//是你当前文章的编号 $sql_former = "select * from sls_wz where id $sql_later = "select * from sls_wz where id>$cid "; //下一篇文章sql语句 $queryset_former = mysql_query($sql_former); //执行sql语句 if(mysql_num_rows($queryset_former)){ //返回记录数,并判断是否为真,以此为依据显示结果 $result = mysql_fetch_array($queryset_former); echo " ".上一章." ". $result['name']." } else {echo " ".这里是第一章哦." ?> | 回目录 | <?php $cid =$row_chapter['id'];//是你当前文章的编号 $sql_former = "select * from sls_wz where id $sql_later = "select * from sls_wz where id>$cid "; //下一篇文章sql语句 $queryset_later = mysql_query($sql_later); if(mysql_num_rows($queryset_later)){ $result = mysql_fetch_array($queryset_later); echo " ".下一章." ". $result['name']." } else {echo " ".下一章还没写哦." ?> |
评论列表
var uyan_config = {
'title':'<?php echo $row_chapter['name']; ?>',
'url':'http://diary.xiahuixin.com/chapter.php?id=<?php echo $row_chapter['id']; ?>',
};
include "footer.php"
?>
mysql_free_result($chapter);
mysql_free_result($system);
mysql_free_result($new_mood);
mysql_free_result($new_chapter);
mysql_free_result($pl);
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史