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.

submit.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?PHP
  2. require_once('inc/account.php');
  3. require_once('inc/database.php');
  4. require_once('inc/settings.php');
  5. require_once('inc/tags.php');
  6. if (!isset($_SESSION['uid'])) {
  7. header('Location: '.BASE);
  8. exit('Must be logged in');
  9. }
  10. if (isset($_POST['quote']) && $_SESSION['standing'] > -2) {
  11. if (get_magic_quotes_gpc()) {
  12. $_POST['quote'] = stripslashes($_POST['quote']);
  13. }
  14. $sql = 'INSERT INTO quotes (quote_quote, quote_time, user_id) VALUES (\''.m($_POST['quote']).'\', '.time().', '.$_SESSION['uid'].')';
  15. mysql_query($sql);
  16. // Broken, see issue #1 - https://github.com/csmith/Quote-DB/issues/1
  17. // doAutoTags(mysql_insert_id());
  18. header('Location: '.BASE.'latest');
  19. exit;
  20. }
  21. define('TITLE', 'Add quote');
  22. require_once('inc/header.php');
  23. ?>
  24. <div class="oneThird right">
  25. <h2>Quote guidelines</h2>
  26. <p>
  27. The usual quote-site rules apply: don't include anything that's not
  28. neccessary, such as timestamps, hostmasks, twenty 'lol's after the funny
  29. part, etc. Try to avoid injokes if possible.
  30. </p>
  31. <p>
  32. <em>Quotes go live as soon as you submit them</em>. There is no moderation.
  33. If you submit a rubbish quote, people will rate it down, and your standing
  34. will fall.
  35. </p>
  36. <p>
  37. Try to stick to standard notation. Enclose nicks in angle brackets
  38. (&lt;nick&gt; hi!), and prefix actions with an asterisk (* nick waves).
  39. Remove mode prefixes (@, +, etc) that don't directly add to the humour.
  40. </p>
  41. </div>
  42. <div>
  43. <?PHP if ($_SESSION['standing'] > -2) { ?>
  44. <h2>Add a quote</h2>
  45. <p>Enter your quote in the text area below. Please read the guidelines to
  46. the right if you haven't done so before.</p>
  47. <form action="submit" method="post">
  48. <textarea name="quote" cols="80" rows="10"></textarea>
  49. <br>
  50. <input type="submit" value="Add">
  51. </form>
  52. <?PHP } else { ?>
  53. <h2>Error</h2>
  54. <p>You do not have sufficient standing to submit a new quote. Please try
  55. <a href="unrated">rating some quotes</a> to increase your standings. </p>
  56. <?PHP } ?>
  57. </div>
  58. <?PHP
  59. require_once('inc/footer.php');
  60. ?>