NoteOnMe博客平台搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 line
4.4 KiB

3 年之前
  1. <?php
  2. require_once "pdo.php";
  3. session_start();
  4. ?>
  5. <!DOCTYPE html>
  6. <head>
  7. <script src="js/jquery.min.js"></script>
  8. <script src="js/bootstrap.min.js"></script>
  9. <script src="js/setting.js"></script>
  10. <meta charset="utf-8"/>
  11. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  12. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
  13. <script src="js/jquery.singlePageNav.min.js"></script>
  14. <link rel="stylesheet" type="text/css" href="css/templatemo-style.css?t={{time()}}">
  15. <style type="text/css">
  16. .hidee{
  17. display:none;
  18. }
  19. .kongxin{
  20. opacity: 1;
  21. padding-top:5%;
  22. color: white;
  23. }
  24. .hi{
  25. background-image:url(image/20121104193601_fTGYm.jpeg);
  26. background-repeat:no-repeat;
  27. height:25em;
  28. background-size:100% 100%;
  29. }
  30. .board{
  31. padding-top:0;
  32. height:100%;
  33. background-color: rgba(0, 0, 0, 0.4);
  34. }
  35. .download-btn{
  36. border: 2px solid #fff;
  37. border-radius: 2px;
  38. color: #fff;
  39. font-size: 2em;
  40. font-weight: bold;
  41. font-family: 'Raleway', sans-serif;
  42. text-transform: uppercase;
  43. padding: 25px 28px;
  44. -webkit-transition: all 0.5s;
  45. -moz-transition: all 0.5s;
  46. -ms-transition: all 0.5s;
  47. -o-transition: all 0.5s;
  48. transition: all 0.5s;
  49. }
  50. .login-btn{
  51. border: 2px solid #fff;
  52. border-radius: 4px;
  53. background:none;
  54. font-size: 2em;
  55. font-weight: bold;
  56. font-family: 'Raleway', sans-serif;
  57. text-transform: uppercase;
  58. padding: 25px 28px;
  59. -webkit-transition: all 0.5s;
  60. -moz-transition: all 0.5s;
  61. -ms-transition: all 0.5s;
  62. -o-transition: all 0.5s;
  63. transition: all 0.5s;
  64. }
  65. .login-btn:hover,
  66. .login-btn:focus,
  67. .dark-blue-btn {
  68. background: #006699;
  69. text-decoration: none;
  70. color: white;
  71. text-decoration: none;
  72. outline: none;
  73. }
  74. .wenzi{
  75. font-size: 1.5em;
  76. }
  77. </style>
  78. </head><body>
  79. <div class="fixed-header">
  80. <div class="container">
  81. <div class="navbar-header">
  82. <button type="button" class="navbar-toggle">
  83. <span class="icon-bar"></span>
  84. <span class="icon-bar"></span>
  85. <span class="icon-bar"></span>
  86. </button>
  87. <a class="navbar-brand" href="#">notebook</a>
  88. </div>
  89. <nav class="main-menu">
  90. <ul>
  91. <form class="form-inline" method="POST" action="search.php">
  92. <input class="form-control" type="text" name="search" placeholder="search">
  93. <li><a href="personal_page.php?user_id=<?php if(isset($_SESSION["user_id"])){echo($_SESSION["user_id"]);}?>" class="external hidee">Home</a></li>
  94. <li> <a href="signup.php" class="hid external">注册</a></li>
  95. <li><a href="login.php" class="hid external">登录</a></li>
  96. <li> <a href="edit_article.php" class="hidee external">写新文章</a> </li>
  97. <li><a href="logout.php" class="hidee external">退出</a></li>
  98. </ul></form>
  99. </nav>
  100. </div>
  101. </div>
  102. <div class="container">
  103. <section class="col-md-12 content" id="home">
  104. <div class="col-lg-12 col-md-12 content-item " style='min-height:0px !important; padding-bottom:2em;' >
  105. <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/>
  106. 愿有一段安静的时光<br/>
  107. 为所爱之事甘之如饴<br/>
  108. 不论南北东西</p><button class="login-btn hid" onclick=" location='login.php'">LOGIN</button>
  109. <button class="login-btn hidee" onclick=" location='edit_article.php'">新文章</button>
  110. </div></div></div>
  111. </div>
  112. <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;" >
  113. <div style="opacity: 1; " >
  114. <ul >
  115. <?php
  116. $stmt = $pdo->query("SELECT * FROM article ORDER BY viewer desc");
  117. while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
  118. if($row['public']=="public")
  119. {
  120. echo ('<li><a href="view.php?article_id='.$row['article_id'].'">');
  121. echo('<h1 class="section-title text-center dark-blue-text">');
  122. echo(htmlentities($row['headline']));
  123. echo("</h1></a> <p>");
  124. $article= substr($row['content'],0,300);
  125. echo(htmlentities($article));
  126. echo("</p></li><hr/>");
  127. }
  128. }
  129. ?>
  130. </ul>
  131. </div>
  132. </div>
  133. </section>
  134. </div>
  135. <div class="text-center footer">
  136. <div class="container"> NOTEBOOK</div>
  137. </div>
  138. </body>
  139. <script>
  140. var user_id = <?php if(isset($_SESSION['user_id'])) {echo($_SESSION['user_id']);}else{echo("null");}?>;
  141. if(user_id!=null)
  142. {
  143. $(".hidee").show();
  144. $(".hid").hide();
  145. }
  146. </script>
  147. </html>