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.

111 lines
2.7 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"] ))
  17. {
  18. header('Location: index.php');
  19. }
  20. $stmt = $pdo->prepare('SELECT category,public FROM article WHERE user_id = :user_id');
  21. $stmt->execute(array( ':user_id' => $_GET["user_id"]));
  22. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  23. if ( $row == false ) {
  24. $flag=0;
  25. }
  26. else{
  27. $flag=1;
  28. if(isset($_SESSION['user_id'])&&$_SESSION['user_id']==$_GET['user_id'])
  29. {
  30. while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
  31. if($row['category']!=null)
  32. {
  33. $category[]=$row['category'];
  34. }
  35. }
  36. }
  37. else{
  38. while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
  39. if($row['category']!=null&&$row['public']=="public")
  40. {
  41. $category[]=$row['category'];
  42. }
  43. }
  44. }
  45. $category=array_unique($category);
  46. }
  47. ?>
  48. <div class="fixed-header">
  49. <div class="container">
  50. <div class="navbar-header">
  51. <button type="button" class="navbar-toggle">
  52. <span class="icon-bar"></span>
  53. <span class="icon-bar"></span>
  54. <span class="icon-bar"></span>
  55. </button>
  56. <a class="navbar-brand" href="#">NOTE</a>
  57. </div>
  58. <nav class="main-menu">
  59. <ul>
  60. <li><a class="external" href="index.php">Home</a></li>
  61. <li><div class="hidee"><a class=" external " href="edit_article.php">新文章</a></div></li>
  62. </ul>
  63. </nav>
  64. </div>
  65. </div>
  66. <div class="container">
  67. <section class="col-md-12 content" id="home">
  68. <div class="col-lg-12 col-md-12 content-item content-item-1">
  69. <ul><hr/>
  70. <?php
  71. if($flag){
  72. foreach($category as $cat) {
  73. echo ('<li style="list-style:none; "><a class="mytitle" href="personal_page2.php?category='.$cat.'&&user_id='.$_GET["user_id"].'">');
  74. echo('<h6 class="section-title text-center ">');
  75. echo(htmlentities($cat));
  76. echo("</h6></a> ");
  77. echo("</li><hr/>");
  78. }
  79. }
  80. ?>
  81. </ul>
  82. <p class="section-title text-center mytitle">M<br/>O<br/>R<br/>E<br/> ...<br/>
  83. </p>
  84. </div>
  85. </section>
  86. </div>
  87. </body>
  88. </html>