Quote database webapp
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.

latest.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?PHP
  2. require_once('inc/database.php');
  3. require_once('inc/tags.php');
  4. define('TITLE', 'Latest');
  5. require_once('inc/header.php');
  6. $sql = 'SELECT quote_id, quote_quote, quote_rating FROM quotes ORDER BY quote_id DESC LIMIT 0,25';
  7. $res = mysql_query($sql)
  8. ?>
  9. <div>
  10. <h2>Latest quotes</h2>
  11. <?PHP
  12. $i = 0;
  13. while ($row = mysql_fetch_array($res)) {
  14. $i = 1 - $i;
  15. if ($i == 1) { $e = 'even'; } else { $e = 'odd'; }
  16. ?>
  17. <div class="quote <?PHP echo $e; ?>">
  18. <?PHP
  19. if (isset($_SESSION['uid'])) {
  20. doRate($row['quote_id']);
  21. }
  22. ?>
  23. <p>
  24. Quote <a href="<?PHP echo BASE; ?>browse?q=<?PHP echo $row['quote_id']; ?>">#<?PHP echo $row['quote_id']; ?></a>.
  25. Rating <?PHP echo round($row['quote_rating'],2); ?>.
  26. <?PHP
  27. if (!isset($_SESSION['uid'])) {
  28. echo ' <a href="'.BASE.'login">Login to rate</a>.';
  29. }
  30. ?>
  31. </p>
  32. <?PHP showTags($row['quote_id']); ?>
  33. <div class="quotebody">
  34. <?PHP echo nl2br(htmlentities($row['quote_quote'], ENT_QUOTES, 'UTF-8')); ?>
  35. </div>
  36. </div>
  37. <?PHP
  38. }
  39. ?>
  40. </div>
  41. <?PHP
  42. require_once('inc/footer.php');
  43. ?>