1 Star 0 Fork 77

顾客/ebookapp

forked from aming/ebookapp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
chapter_ctx_next.php 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
include_once "init.php";
include_once WEB_ROOT."util/mysql_class.php";
include_once WEB_ROOT."smarty_inc.php";
include_once WEB_ROOT."admin/funcs/make_article_func.php";
include_once WEB_ROOT."admin/funcs/app_util_func.php";
include_once WEB_ROOT."admin/funcs/make_single_chapter_func.php";
include_once WEB_ROOT."util/util.php";
include_once WEB_ROOT."util/Model_class.php";
include_once WEB_ROOT.'admin/Parser_class.php';
include_once 'third_part/simple_html_dom.php';
include_once 'util/mobile_redirect.php';
//$db = new mysql();
if(@$_GET["chapter_id"]){
$chapter_id = str_check($_GET["chapter_id"]);
$article_id = str_check($_GET["article_id"]);
$flag = $_GET["flag"];
if(strcmp($flag,"next")==0){
//echo "1";
$next_id = next_chapter_func($chapter_id,$article_id);
}else{
//echo "2";
$next_id = last_chapter_func($chapter_id,$article_id);
}
//echo $next_id;
navToChapter($next_id);
}else{
echo "artileid missing";
}
function next_chapter_func($chapter_id,$article_id){
$db = new mysql();
$sql_select="select * from t_chapter where id > ".$chapter_id." and artile_id=".$article_id." order by id limit 0,1";
$query = $db->query($sql_select);
$count = 0;
$row=$db->fetch_row_array($query);
if($row){
return $row["id"];
}else{
return -1;
}
}
function last_chapter_func($chapter_id,$article_id){
$db = new mysql();
$sql_select="select * from t_chapter where id < ".$chapter_id." and artile_id=".$article_id." order by id desc limit 0,1";
$query = $db->query($sql_select);
$count = 0;
$row=$db->fetch_row_array($query);
if($row){
return $row["id"];
}else{
return -1;
}
}
function navToChapter($chapter_id){
if($chapter_id<0){
echo "<head><meta charset=\"gb2312\"></head>ѵҳ ";
return;
}
$local_url="/data/chapters/".$chapter_id.".htm";
$act_file = WEB_ROOT.$local_url;
if(!file_exists($act_file)){
try{
make_chapter_func($chapter_id,false);
}catch(Exception $e){
}
}
if(file_exists($act_file)){
echo read_file_content($act_file);
}else{
showErrorPage($chapter_id);
}
}
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guke/ebookapp.git
git@gitee.com:guke/ebookapp.git
guke
ebookapp
ebookapp
master

搜索帮助