Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. <?php
  2. include("menu.php");
  3. mysql_conn));
  4. mysql_ser());
  5. if(isset($_COOKIE['login'])) {
  6. $logincookie = explode(" ", $_COOKIE[login]);
  7. echo "<div class=\"log\">Logged in as <a href=\"edit.php\">";
  8. echo $logincookie[0];
  9. echo "</a><a style=\"float: right\" href=\"log.php?act=out\">(log out)</a></div>";
  10.  
  11.  
  12. $message = $_POST['message'];
  13. $message = stripslashes($message);
  14. $message = str_replace("\n", "<br />", $message);
  15. $message = strip_tags($message, '<b><i><u><blockquote>');
  16. $message_no_spaces = preg_replace("/[^a-zA-Z0-9s]/", "", $message);
  17.  
  18.  
  19. $topic_info = mysql_query("SELECT * FROM topic WHERE id='$_GET[id]'")
  20. or die(mysql_error());
  21.  
  22. $info = mysql_fetch_array($topic_info);
  23.  
  24. $forum_info = mysql_query("SELECT * FROM forum WHERE forum_id='$_GET[f]'")
  25. or die(mysql_error());
  26.  
  27. $forum = mysql_fetch_array($forum_info);
  28.  
  29.  
  30. $hidden = "
  31.  
  32. <form method=\"post\" action=\"?act=confirm&f=$_GET[f]&id=$_GET[id]\">
  33.  
  34. <div class=\"desc-curve\">
  35.  
  36. <span class=\"left\">message</span> Type in a message to go with your topic. (maximum 10,000 characters) <div class=\"desc\"><textarea cols=\"50\" rows=\"10\" wrap=\"hard\" name=\"message\">$message</textarea></div>
  37.  
  38. <span class=\"left\">submit</span> Confirm all submissions by submitting all information.
  39. <div class=\"desc\"><input type=\"submit\" value=\"Send\"> </div>
  40. </div>
  41. </form>
  42. ";
  43.  
  44.  
  45.  
  46. if( $_GET[act] == "confirm" && $message ) {
  47.  
  48. $namecheck = mysql_query("SELECT * FROM user WHERE name='$username'")
  49. or die(mysql_error());
  50.  
  51.  
  52. $row = mysql_fetch_array($namecheck);
  53.  
  54.  
  55.  
  56.  
  57. if ( strlen($message_no_spaces) > 10000 ) {
  58. echo "<div class=\"warning\">Your message is too long. You are only allowed a maximum of $admin[1] characters in your message. You have ". strlen($message_no_spaces). " characters.</div>";
  59. $reginfo = $hidden;
  60.  
  61. } elseif ( strlen($message_no_spaces) < 3 ) {
  62.  
  63. if ( strlen($message_no_spaces) == 1 ) {
  64. $plural = "character";
  65. } else {
  66. $plural = "characters";
  67. }if ( strlen($message_no_spaces) == 1 ) {
  68. $plural = "character";
  69. } else {
  70. $plural = "characters";
  71. }
  72.  
  73. echo "<div class=\"warning\">Your message is too short. You are only allowed a minimum of $admin[1] characters in your message. You have ". strlen($message_no_spaces). " $plural.</div>";
  74. $reginfo = $hidden;
  75.  
  76. } elseif ( $info[id] == 0 ) {
  77.  
  78. echo "<div class=\"warning\">You cannot post in a topic that doesn't exist.</div>";
  79. $reginfo = $hidden;
  80.  
  81. } elseif ( $forum[forum_id] == 0 ) {
  82.  
  83. echo "<div class=\"warning\">You cannot post in a forum that doesn't exist.</div>";
  84. $reginfo = $hidden;
  85.  
  86. } elseif ( $info[forum] !== $forum[forum_id] ) {
  87.  
  88. echo "<div class=\"warning\">There is a syntax error with your submission. The topic you posted in is not hosted on the right forum that you have selected. Please refrain from tampering with the URL, it's hopeless. :P</div>";
  89. $reginfo = $hidden;
  90.  
  91.  
  92. } else {
  93. $password = md5($password);
  94. echo "Your registration has been accepted. An admin has chose to require your account to be validated. In order to use your account, you need to confirm your email address by going to your email account.";
  95.  
  96.  
  97. $namecheck = mysql_query("SELECT * FROM user WHERE name='$logincookie[0]'")
  98. or die(mysql_error());
  99.  
  100.  
  101. $user = mysql_fetch_array($namecheck);
  102.  
  103. mysql_query("INSERT INTO message
  104. (user, message, forum, topic_id) VALUES('$user[id]', '$message', '$_GET[f]', '$_GET[id]') ")
  105. or die(mysql_error());
  106.  
  107. $message_info = mysql_query("SELECT * FROM message")
  108. or die(mysql_error());
  109. $message2 = mysql_fetch_array($message_info);
  110. $result = mysql_query("UPDATE topic SET bump='$message2[id]' WHERE id='info[id]'")
  111.  
  112. }
  113.  
  114. } // end $_GET[act] == "confirm"
  115.  
  116. if( $_GET[act] !== "confirm" ) {
  117. $reginfo = $hidden;
  118. }
  119.  
  120. echo $reginfo;
  121.  
  122. } else { // Everything below is what shows up if a user isn't logged in.
  123.  
  124. echo "<div class=\"warning\">You need to be logged in to view this page.</div>";
  125. }
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement