NoteOnMe博客平台搭建
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

171 行
4.4 KiB

<?php
require_once "pdo.php";
session_start();
?>
<!DOCTYPE html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/setting.js"></script>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script src="js/jquery.singlePageNav.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/templatemo-style.css?t={{time()}}">
<style type="text/css">
.hidee{
display:none;
}
.kongxin{
opacity: 1;
padding-top:5%;
color: white;
}
.hi{
background-image:url(image/20121104193601_fTGYm.jpeg);
background-repeat:no-repeat;
height:25em;
background-size:100% 100%;
}
.board{
padding-top:0;
height:100%;
background-color: rgba(0, 0, 0, 0.4);
}
.download-btn{
border: 2px solid #fff;
border-radius: 2px;
color: #fff;
font-size: 2em;
font-weight: bold;
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
padding: 25px 28px;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.login-btn{
border: 2px solid #fff;
border-radius: 4px;
background:none;
font-size: 2em;
font-weight: bold;
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
padding: 25px 28px;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.login-btn:hover,
.login-btn:focus,
.dark-blue-btn {
background: #006699;
text-decoration: none;
color: white;
text-decoration: none;
outline: none;
}
.wenzi{
font-size: 1.5em;
}
</style>
</head><body>
<div class="fixed-header">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">notebook</a>
</div>
<nav class="main-menu">
<ul>
<form class="form-inline" method="POST" action="search.php">
<input class="form-control" type="text" name="search" placeholder="search">
<li><a href="personal_page.php?user_id=<?php if(isset($_SESSION["user_id"])){echo($_SESSION["user_id"]);}?>" class="external hidee">Home</a></li>
<li> <a href="signup.php" class="hid external">注册</a></li>
<li><a href="login.php" class="hid external">登录</a></li>
<li> <a href="edit_article.php" class="hidee external">写新文章</a> </li>
<li><a href="logout.php" class="hidee external">退出</a></li>
</ul></form>
</nav>
</div>
</div>
<div class="container">
<section class="col-md-12 content" id="home">
<div class="col-lg-12 col-md-12 content-item " style='min-height:0px !important; padding-bottom:2em;' >
<div class="hi " style="text-align:center;"><div class="board"><div class="kongxin"><p class="wenzi">Let yourself be silently drawnby the stronger pull <br/>of what you really love.<br/>
愿有一段安静的时光<br/>
为所爱之事甘之如饴<br/>
不论南北东西</p><button class="login-btn hid" onclick=" location='login.php'">LOGIN</button>
<button class="login-btn hidee" onclick=" location='edit_article.php'">新文章</button>
</div></div></div>
</div>
<div class="col-lg-12 col-md-12 content-item content-item-1 background" style=" background-color: rgba(255,255,255, 0.7);border-top:2em;" >
<div style="opacity: 1; " >
<ul >
<?php
$stmt = $pdo->query("SELECT * FROM article ORDER BY viewer desc");
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
if($row['public']=="public")
{
echo ('<li><a href="view.php?article_id='.$row['article_id'].'">');
echo('<h1 class="section-title text-center dark-blue-text">');
echo(htmlentities($row['headline']));
echo("</h1></a> <p>");
$article= substr($row['content'],0,300);
echo(htmlentities($article));
echo("</p></li><hr/>");
}
}
?>
</ul>
</div>
</div>
</section>
</div>
<div class="text-center footer">
<div class="container"> NOTEBOOK</div>
</div>
</body>
<script>
var user_id = <?php if(isset($_SESSION['user_id'])) {echo($_SESSION['user_id']);}else{echo("null");}?>;
if(user_id!=null)
{
$(".hidee").show();
$(".hid").hide();
}
</script>
</html>