2 Star 2 Fork 4

Tody_Guo/php_issue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tewiki.php 5.84 KB
一键复制 编辑 原始数据 按行查看 历史
jiahui.guo 提交于 2021-07-01 14:51 . update code
<?php
include 'inc/conn.php';
$pageSize = 20;
$phpself =$_SERVER['PHP_SELF'];
$pagestr = end(explode("/",$phpself));
?>
<!DOCTYPE html>
<html>
<head>
<title>工程知识库(Engineering Wiki System)</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<?
$view=0; /*default is list*/
extract($_POST);
extract($_GET);
unset($_POST,$_GET);
if (isset($view))
{
if ($view == "1"){
$view=1;
}else{
$view=0;
}
}
if (!isset($page)){
$page = 1;
}
$pageCount = 0;
$db = new mysql();
if (isset($search))
$db->query("select * from te_wiki_table where wiki_title like '%$search%' or wiki_body like '%$search%'");
else
$db->query("select count(id) as CNT from te_wiki_table");
$row = $db->fetch_assoc();
$rowCount = $row['CNT'];
$db->close();
$pageCount = ceil(($rowCount/$pageSize));
$pre = ($page-1)*$pageSize;
?>
<script language="javascript">
function Go(it) {
window.location="<? echo $pagestr ?>?page="+it.value;
}
</script>
<script type="text/javascript">
function goTopEx() {
var obj = document.getElementById("goTopBtn");
function getScrollTop() {
return document.documentElement.scrollTop + document.body.scrollTop;
}
function setScrollTop(value) {
if (document.documentElement.scrollTop) {
document.documentElement.scrollTop = value;
} else {
document.body.scrollTop = value;
}
}
window.onscroll = function() {
getScrollTop() > 0 ? obj.style.display = "": obj.style.display = "none";
}
obj.onclick = function() {
var goTop = setInterval(scrollMove, 10);
function scrollMove() {
setScrollTop(getScrollTop() / 1.1);
if (getScrollTop() < 1) clearInterval(goTop);
}
}
}
</script>
<style>
BODY {
HEIGHT: auto;
}
#goTopBtn {
POSITION: fixed; TEXT-ALIGN: center; LINE-HEIGHT: 30px; WIDTH: 30px; BOTTOM: 35px;
HEIGHT: 33px; FONT-SIZE: 12px; CURSOR: pointer; RIGHT: 0px; _position: absolute; _right: auto
}
</style>
</head>
<body class="background">
<div style="display: none" id="goTopBtn"><img border=0 src="/image/top.jpg"></div>
<script type=text/javascript>goTopEx();</script>
<?
include "top.php";
echo "<div class='container-fluid'>";
echo " <div><h3><span class='label label-primary'>工程知识库(Engineering Wiki System)</span></h3></div>";
echo " <div class='well'> ";
echo " <form class='form-inline'>";
echo " <div style='form-group'>";
if (isset($search))
echo " 维基搜索:<input type='text' class='form-control' name='search' value='$search'><button type='submit' class='btn btn-info'>Search</button>";
else
echo " 维基搜索:<input type='text' class='form-control' name='search'><button type='submit' class='btn btn-info'>Search</button>";
echo " <div style='float:right'>视图:<a href='tewiki.php?view=0'><span class=\"glyphicon glyphicon-th-list\"></span> 列表</a> | <a href='tewiki.php?view=1'><span class=\"glyphicon glyphicon-th\"></span> 详细</a></div>";
echo " </div>";
echo " </form>";
echo " </div>";
echo " <div> ";
if ($view == 0){
echo "<table border=0 cellpadding=0 class='table table-striped'>";
echo '<tr class="success"><th>Item</th><th>标题</th><th>作者</th><th>发布时间</th><th>更新时间</th></tr>';
}
$db = new mysql();
if (isset($search))
$db->query("select * from te_wiki_table where wiki_title like '%$search%' or wiki_body like '%$search%' ORDER BY wiki_build_date DESC limit $pre,$pageSize");
else
$db->query("select * from te_wiki_table ORDER BY wiki_build_date DESC limit $pre,$pageSize");
$num = $db->db_num_rows();
for($i=0; $i<$num; $i++){
$row = $db->fetch_assoc();
if ($view == 0){
$item=$i+1;
echo "<tr>";
echo "<td>$item</td>";
echo "<td><a href=\"review_wiki.php?id=".$row['ID']."\">".htmlspecialchars_decode($row['wiki_title'])."</a></td>";
echo "<td>".$row['wiki_writor']."</td>";
echo "<td>".substr($row['wiki_build_date'],0,10)."</td>";
echo "<td>".substr($row['wiki_update_date'],0,10)."</td>";
echo "</tr>\n";
}else{
echo "<div class='alert alert-info'><h3>".htmlspecialchars_decode($row['wiki_title'])."</h3><strong>编写:</strong>".htmlspecialchars_decode($row['wiki_writor'])."&nbsp;&nbsp;&nbsp;&nbsp;<strong>编写日期:</strong>".htmlspecialchars_decode($row['wiki_build_date'])."</div>";
echo "<div class='well'>".htmlspecialchars_decode($row['wiki_body'])."</div>";
}
}
if ($view == 0)
echo "</table>";
echo "</div>";
if($pageCount>1) {
?>
<div align="center">
<ul class='pager'>
<li class='previous'><a href="<? echo $pagestr ?>?page=<?if($page>=2) echo $page-1; else echo $page;?>">&larr;上一页</a></li>
<select name="page" id="page" onchange="javascript:Go(this);">
<?
for($j=1;$j<=$pageCount;$j++){
if($j==$page)
echo "<option value='$j' selected='$j'>$j</option>\n";
else
echo "<option value='$j'>$j</option>\n";
}
?>
</select>
<li class='next'><a href="<? echo $pagestr ?>?page=<?if($page<$pageCount) echo $page+1; else echo 1;?>">下一页&rarr;</a></li>
</ul>
</div>
<? } ?>
</div>
<?
include 'bottom.php';
?>
</body>
</html>
<?
$db->close();
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/tody_guo/php_issue.git
git@gitee.com:tody_guo/php_issue.git
tody_guo
php_issue
php_issue
master

搜索帮助