Guest User

Untitled

a guest
Aug 5th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. <?php
  2. if($_POST["joke"]) {
  3.  
  4. $host = "localhost";
  5. $username = "connorm_jokes";
  6. $password = "omglol!@#123";
  7. $db = "connorm_jokes";
  8.  
  9. mysql_connect($host, $username, $password) or die(mysql_error());
  10. mysql_select_db($db) or die(mysql_error());
  11.  
  12. $joke = mysql_real_escape_string($_POST["joke"]);
  13. $words = explode(" ", $joke);
  14.  
  15. $randjokes = mysql_query("SELECT * FROM `jokes`");
  16. $jokeid = round(rand(1, mysql_num_rows($randjokes)), 0);
  17. $jokerow = mysql_fetch_array(mysql_query("SELECT * from `jokes` WHERE `id`=$jokeid"));
  18.  
  19. while($jokerow["joke"] == "Q: Why did the chicken cross the road?<br />
  20. A: To go the the other side!") {
  21. $jokeid = round(rand(1, mysql_num_rows($randjokes)), 0);
  22. $jokerow = mysql_fetch_array(mysql_query("SELECT * from `jokes` WHERE `id`=$jokeid"));
  23. }
  24. if($jokerow["flag"] > 0){
  25. echo '<div style="display: block;" id="flagwarning"><p><strong>warning</strong>warning: this joke has been flagged by one of more people as innapropriate. it may contain topics that for mature views. if you would like to continue, click "ignore" below. if you would like a new joke, click "gimme another". keep in mind that the thoughts expressed in these jokes are not to be taken to heart and are only meant to be humorous. all jokes are submitted by visitors and do not reflect the thoughts of jokepop.</p><p><a href="javascript: hideWarning();">ignore</a> | <a href="javascript: newJoke();">gimme another</a></p><p></p></div><div style="display: none;" id="jokecontainer"><div id="rfrbar"><iframe frameborder="0" scrolling="no" src="rateframe.php?id=' . $jokerow["id"] . '" width="85" height="16"></iframe><a class="flaglink" id="f' . $jokerow["id"] . '" href="#flag">flag</a><a class="reportlink" id="r' . $jokerow["id"] . '" href="#report">report</a><br class="clear" /></div>';
  26. echo '<div id="thejoke">' . strip_tags($jokerow["joke"], '<br><br />') . '</div>';
  27. echo '<div id="googleads"><iframe frameborder="0" scrolling="no" src="adsframe.php?id=' . $jokerow["id"] . '" width="468" height="15"></iframe></div></div>';
  28. } else {
  29. echo '<div style="display: none;" id="flagwarning"></div><div style="display: block;" id="jokecontainer"><div id="rfrbar"><iframe frameborder="0" scrolling="no" src="rateframe.php?id=' . $jokerow["id"] . '" width="85" height="16"></iframe><a class="flaglink" id="f' . $jokerow["id"] . '" href="#flag">flag</a><a class="reportlink" id="r' . $jokerow["id"] . '" href="#report">report</a><br class="clear" /></div>';
  30. echo '<div id="thejoke">' . strip_tags($jokerow["joke"], '<br><br />') . '</div>';
  31. echo '<div id="googleads"><iframe frameborder="0" scrolling="no" src="adsframe.php?id=' . $jokerow["id"] . '" width="468" height="15"></iframe></div></div>';
  32. }
  33. $insert = "INSERT INTO `jokes` (joke, user, flag, report, total_votes, total_value, used_ips) VALUES ('$joke', 'anon', '0', '0', '0', '0', '')";
  34. mysql_query($insert) or die(mysql_error());
  35.  
  36. }
  37. if($_POST["new"]){
  38. if($_POST["new"] == "yes"){
  39. $host = "localhost";
  40. $username = "connorm_jokes";
  41. $password = "omglol!@#123";
  42. $db = "connorm_jokes";
  43.  
  44. mysql_connect($host, $username, $password) or die(mysql_error());
  45. mysql_select_db($db) or die(mysql_error());
  46.  
  47. $joke = mysql_real_escape_string(nl2br($_POST["joke"]));
  48. $words = explode(" ", $joke);
  49.  
  50. $randjokes = mysql_query("SELECT * FROM `jokes`");
  51. $jokeid = round(rand(1, mysql_num_rows($randjokes)), 0);
  52. $jokerow = mysql_fetch_array(mysql_query("SELECT * from `jokes` WHERE `id`=$jokeid"));
  53.  
  54. while($jokerow["joke"] == "Q: Why did the chicken cross the road?<br />
  55. A: To go the the other side!") {
  56. $jokeid = round(rand(1, mysql_num_rows($randjokes)), 0);
  57. $jokerow = mysql_fetch_array(mysql_query("SELECT * from `jokes` WHERE `id`=$jokeid AND `flag`=0 "));
  58. }
  59.  
  60. echo '<div style="display: none;" id="flagwarning"></div><div style="display: block;" id="jokecontainer"><div id="rfrbar"><iframe frameborder="0" scrolling="no" src="rateframe.php?id=' . $jokerow["id"] . '" width="85" height="16"></iframe><a class="flaglink" id="f' . $jokerow["id"] . '" href="#flag">flag</a><a class="reportlink" id="r' . $jokerow["id"] . '" href="#report">report</a><br class="clear" /></div>';
  61. echo '<div id="thejoke">' . strip_tags($jokerow["joke"], '<br><br />') . '</div>';
  62. echo '<div id="googleads"><iframe frameborder="0" scrolling="no" src="adsframe.php?id=' . $jokerow["id"] . '" width="468" height="15"></iframe></div></div>';
  63. } else {
  64. //
  65. }
  66. }
  67. if($_POST["nojoke"]){
  68. echo "you are an asshole";
  69. }
  70. ?>
Add Comment
Please, Sign In to add comment