turt2live

Untitled

Apr 29th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 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. <title>McNally robotics build log</title>
  13. </head>
  14. <body>
  15.  
  16. <p>
  17. <?php
  18. if($userid && $username){
  19. echo "Welcome <strong>$username!</strong>";
  20. $form = "
  21. <table>
  22. <tr>
  23. <td><a href='./member.php'>Members page</a></td>
  24. <td><a href='./logelements/addpost.php'>Add a post</a></td>
  25. </tr>
  26. </table>";
  27. echo $form;
  28. }else{
  29. echo '<p><a href="./login.php">Login</a>';
  30. }
  31.  
  32. ?>
  33.  
  34.  
  35.  
  36. <br>
  37. This is the McNally High Robotics build and design online log.</p>
  38.  
  39.  
  40. <?php
  41. require("./PHPScripts/logconnector.php");
  42. $id = 1;
  43. $query = mysql_query("SELECT * FROM log WHERE isValid='$id' ");
  44.  
  45.  
  46. echo '<table border="1" align="center">';
  47. while($row = mysql_fetch_array($query)){
  48. $post = $row['post'];
  49. $date = $row['date'];
  50. $user = $row['user'];
  51. echo "<br>";
  52. echo "<tr>";
  53. echo "$date";
  54. echo "<br>";
  55. echo "<tr>";
  56. echo "$post";
  57. echo "<br>";
  58. echo "<tr>";
  59. echo "$user";
  60. echo "<br>";
  61. echo "</tr>";
  62.  
  63. }
  64. echo "</table>";
  65.  
  66. /*
  67.  
  68. require("./PHPScripts/logconnector.php");
  69. $id = 1;
  70. $query = mysql_query("SELECT * FROM log WHERE isValid='$id' ");
  71.  
  72. $numrows = mysql_num_rows($query);
  73. $numPosts = $numrows;
  74.  
  75.  
  76. echo '<table border="1" align="center">';
  77. for($counter = 1; $counter <= $numPosts; $counter += 1){
  78. $query = mysql_query("SELECT * FROM log WHERE id='$counter'");
  79. $row = mysql_fetch_assoc($query);
  80. $post = $row['post'];
  81. $date = $row['date'];
  82. $user = $row['user'];
  83. $title = $row['title'];
  84. echo "<br>";
  85. echo "<tr>";
  86. echo "$date";
  87. echo "<br>";
  88. echo "<tr>";
  89. echo "$title";
  90. echo "<br>";
  91. echo "<tr>";
  92. echo "$post";
  93. echo "<br>";
  94. echo "<tr>";
  95. echo "$user";
  96. echo "<br>";
  97. echo "</tr>";
  98.  
  99. }
  100. echo "</table>";
  101.  
  102.  
  103. */
  104.  
  105. ?>
  106.  
  107. </body>
  108. </html>
Advertisement
Add Comment
Please, Sign In to add comment