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.

101 lines
2.9 KiB

3 years ago
  1. <!DOCTYPE html>
  2. <head>
  3. <script src="js/jquery.min.js"></script>
  4. <script src="js/bootstrap.min.js"></script>
  5. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  6. <script src="js/jquery.singlePageNav.min.js"></script>
  7. <script src="js/setting.js"></script>
  8. <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  9. <meta charset="utf-8"/>
  10. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
  11. <link rel="stylesheet" type="text/css" href="css/templatemo-style.css?t={{time()}}">
  12. </head><body>
  13. <?php
  14. require_once "pdo.php";
  15. session_start();
  16. if(!isset($_GET["user_id"]) ||!isset($_GET["category"] ))
  17. {
  18. header('Location: index.php');
  19. }
  20. $stmt = $pdo->prepare('SELECT headline,public,article_id,content FROM article WHERE user_id = :user_id and category=:category');
  21. $stmt->execute(array( ':user_id' => $_GET["user_id"],':category'=>$_GET["category"]));
  22. ?>
  23. <div class="fixed-header">
  24. <div class="container">
  25. <div class="navbar-header">
  26. <button type="button" class="navbar-toggle">
  27. <span class="icon-bar"></span>
  28. <span class="icon-bar"></span>
  29. <span class="icon-bar"></span>
  30. </button>
  31. <a class="navbar-brand" href="#">NOTE</a>
  32. </div>
  33. <nav class="main-menu">
  34. <ul>
  35. <li><a class="external" href="index.php">Home</a></li>
  36. <li><div class="hidee"><a class=" external " href="edit_article.php">新文章</a></div></li>
  37. </ul>
  38. </nav>
  39. </div>
  40. </div>
  41. <div class="container">
  42. <section class="col-md-12 content" id="home">
  43. <div class="col-lg-12 col-md-12 content-item content-item-1 background" >
  44. <ul style="margin-top:5em;" >
  45. <?php
  46. while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
  47. if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$_GET['user_id']){
  48. echo ('<li><a href="view.php?article_id='.$row['article_id'].'">');
  49. echo('<h1 class="section-title text-center dark-blue-text">');
  50. echo(htmlentities($row['headline']));
  51. echo("</h2></a> <p>");
  52. $article= substr($row['content'],0,300);
  53. echo(htmlentities($article));
  54. echo("</p></li><hr/>");
  55. }
  56. else{
  57. if($row['public']=="public")
  58. {
  59. echo ('<li><a href="view.php?article_id='.$row['article_id'].'">');
  60. echo('<h1 class="section-title text-center dark-blue-text">');
  61. echo(htmlentities($row['headline']));
  62. echo("</h2></a> <p>");
  63. $article= substr($row['content'],0,300);
  64. echo(htmlentities($article));
  65. echo("</p></li><hr/>");
  66. }
  67. }
  68. }
  69. ?>
  70. </ul>
  71. <p class="section-title text-center mytitle">M<br/>O<br/>R<br/>E<br/> ...<br/>
  72. </p>
  73. </div>
  74. </section>
  75. </div>
  76. </body>
  77. </html>