turt2live

Untitled

Apr 30th, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL ^ E_NOTICE);
  3. session_start();
  4. $userid = $_SESSION['id'];
  5. $username = $_SESSION['username'];
  6. ?>
  7.  
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <link rel="stylesheet" type="text/css" href="/css/stylesheet.css">
  13. <title>McNally robotics build log</title>
  14. </head>
  15. <body>
  16.  
  17. <!-- Body Wrapper -->
  18. <div class ="mainWrapper">
  19. <!-- Menu Bar -->
  20. <div class="menubar">
  21. <?php
  22. if($userid && $username){
  23. echo "Welcome <strong>$username!</strong>";
  24. $form = "
  25. <table>
  26. <tr>
  27. <td><a href='./member.php'>Members page</a></td>
  28. <td><a href='./logelements/addpost.php'>Add a post</a></td>
  29. </tr>
  30. </table>";
  31. echo $form;
  32. }else{
  33. echo '<p><a href="./login.php">Login</a>';
  34. }
  35. ?>
  36. </div>
  37.  
  38. <!-- Main Div -->
  39. <div class="maindiv">
  40. <p>
  41. <br>
  42. This is the McNally High Robotics build and design online log.
  43. </p>
  44. <?php
  45. require("./PHPScripts/logconnector.php");
  46. $id = 1;
  47. $query = mysql_query("SELECT * FROM log WHERE isValid='$id' ");
  48. while($row = mysql_fetch_array($query)){
  49. echo '<div style="width:100%;padding-bottom:5px;">'; // Start a new post
  50. $post = $row['post'];
  51. $date = $row['date'];
  52. $user = $row['user'];
  53. $title = $row['Title:'];
  54. echo "<h4>$title</h4>";
  55. echo "<p>$post</p>";
  56. echo "<span style='font-size:14px;'>$date (by $user)</span>"
  57. echo "</div>"; // Close post div
  58. }
  59. /*
  60.  
  61. require("./PHPScripts/logconnector.php");
  62. $id = 1;
  63. $query = mysql_query("SELECT * FROM log WHERE isValid='$id' ");
  64.  
  65. $numrows = mysql_num_rows($query);
  66. $numPosts = $numrows;
  67.  
  68.  
  69. echo '<table border="1" align="center">';
  70. for($counter = 1; $counter <= $numPosts; $counter += 1){
  71. $query = mysql_query("SELECT * FROM log WHERE id='$counter'");
  72. $row = mysql_fetch_assoc($query);
  73. $post = $row['post'];
  74. $date = $row['date'];
  75. $user = $row['user'];
  76. $title = $row['title'];
  77. echo "<br>";
  78. echo "<tr>";
  79. echo "$date";
  80. echo "<br>";
  81. echo "<tr>";
  82. echo "$title";
  83. echo "<br>";
  84. echo "<tr>";
  85. echo "$post";
  86. echo "<br>";
  87. echo "<tr>";
  88. echo "$user";
  89. echo "<br>";
  90. echo "</tr>";
  91.  
  92. }
  93. echo "</table>";
  94.  
  95.  
  96. */
  97. ?>
  98. </div> <!-- End Main Div -->
  99. </div> <!-- End Wrapper -->
  100. </body>
  101. </html>
Advertisement
Add Comment
Please, Sign In to add comment