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 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. addAutoTags(mysql_insert_id());
  17. header('Location: '.BASE.'latest');
  18. exit;
  19. }
  20. define('TITLE', 'Add quote');
  21. require_once('inc/header.php');
  22. ?>
  23. <div class="oneThird right">
  24. <h2>Quote guidelines</h2>
  25. <p>
  26. The usual quote-site rules apply: don't include anything that's not
  27. neccessary, such as timestamps, hostmasks, twenty 'lol's after the funny
  28. part, etc. Try to avoid injokes if possible.
  29. </p>
  30. <p>
  31. <em>Quotes go live as soon as you submit them</em>. There is no moderation.
  32. If you submit a rubbish quote, people will rate it down, and your standing
  33. will fall.
  34. </p>
  35. <p>
  36. Try to stick to standard notation. Enclose nicks in angle brackets
  37. (&lt;nick&gt; hi!), and prefix actions with an asterisk (* nick waves).
  38. Remove mode prefixes (@, +, etc) that don't directly add to the humour.
  39. </p>
  40. </div>
  41. <div>
  42. <?PHP if ($_SESSION['standing'] > -2) { ?>
  43. <h2>Add a quote</h2>
  44. <p>Enter your quote in the text area below. Please read the guidelines to
  45. the right if you haven't done so before.</p>
  46. <form action="submit" method="post">
  47. <textarea name="quote" cols="80" rows="10"></textarea>
  48. <br>
  49. <input type="submit" value="Add">
  50. </form>
  51. <?PHP } else { ?>
  52. <h2>Error</h2>
  53. <p>You do not have sufficient standing to submit a new quote. Please try
  54. <a href="unrated">rating some quotes</a> to increase your standings. </p>
  55. <?PHP } ?>
  56. </div>
  57. <?PHP
  58. require_once('inc/footer.php');
  59. ?>