0.8.1a
[gfh.git] / modnotice.php
blob57499265c927396f98ffa9e78991ad8c7ea7a615
1 <?php include ("config.php");
2 function auth($userid, $password)
4 $sql = "SELECT username FROM users WHERE username='$userid' AND userpass='$password'";
5 $result = mysql_query($sql);
6 if (!mysql_num_rows($result))
7 return 0;
8 else
10 $query_data = mysql_fetch_row($result);
11 return $query_data[0];
14 function timetime($topicid)
16 $sql = "SELECT * FROM messages WHERE messageid='$topicid'";
17 $result = mysql_query($sql);
18 $myrow = mysql_fetch_array($result);
19 $timey = substr($myrow["messsec"], 0, 4).'-'.substr($myrow["messsec"], 4, 2).'-'.substr($myrow["messsec"], 6, 2).' '.substr($myrow["messsec"], 8, 2).':'.substr($myrow["messsec"], 10, 2).':'.substr($myrow["messsec"], 12, 2);
20 return $timey;
22 function getlevel($username)
24 $sql = "SELECT * FROM users WHERE username='$username'";
25 $result = mysql_query($sql);
26 $myrow = mysql_fetch_array($result);
27 return $myrow["level"];
29 $username = auth($uname, $pword);
30 if (!$username)
32 echo "You cannot mark messages.";
33 exit;
35 if (!$board)
37 echo "Invalid boardID.";
38 exit;
40 if (!$topic)
42 echo "Invalid topicID.";
43 exit;
45 if (!$message)
47 echo "Invalid messageID.";
48 exit;
50 $getlevel = getlevel($uname);
51 if (($getlevel < 50) AND ($board == 20))
53 echo "You cannot mark messages on the asshole board.";
54 exit;
56 include ("colors.inc");
57 include ("top.inc");
58 if ($submit)
60 $sql = "SELECT * FROM marked WHERE message='$message'";
61 $result = mysql_query($sql);
62 $myrow = mysql_fetch_array($result);
63 if (mysql_num_rows($result) >= 1 AND $myrow["active"] == 0)
65 $markid = $myrow["markid"];
66 $sql = "UPDATE marked SET markedtimes='1' WHERE markid='$markid'";
67 $result = mysql_query($sql);
68 $sql = "UPDATE marked SET active='1' WHERE markid='$markid'";
69 $result = mysql_query($sql);
70 echo "<font color=black>Thank you for marking this probably stupid and inane message. Return to from which you <a href=messagelist.php?board=".$board."&topic=".$topic."><font color=blue>came</font></a>.";
71 exit;
73 if (mysql_num_rows($result) >= 1)
75 $markid = $myrow["markid"];
76 $markt = $myrow["markedtimes"] + 1;
77 $sql = "UPDATE marked SET markedtimes='$markt' WHERE markid='$markid'";
78 $result = mysql_query($sql);
79 echo "<font color=black>Thank you for marking this probably stupid and inane message. Return to from which you <a href=messagelist.php?board=".$board."&topic=".$topic."><font color=blue>came</font></a>.";
80 exit;
82 if ($reason == 4)
84 $sql = "SELECT * FROM users WHERE username='$uname'";
85 $result = mysql_query($sql);
86 $myrow = mysql_fetch_array($result);
87 $usename = $myrow["username"];
88 $other = htmlspecialchars($other);
89 $sql = "INSERT INTO marked (reason,markwho,message,topic,board,active,reason2,markedtimes) VALUES ('$reason','$usename','$message','$topic','$board','1','$other','1')";
90 $result = mysql_query($sql);
91 echo "<font color=black>Thank you for marking this probably stupid and inane message. Return to from which you <a href=messagelist.php?board=".$board."&topic=".$topic."><font color=blue>came</font></a>.";
92 exit;
94 $sql = "SELECT * FROM users WHERE username='$uname'";
95 $result = mysql_query($sql);
96 $myrow = mysql_fetch_array($result);
97 $usename = $myrow["username"];
98 $sql = "INSERT INTO marked (reason,markwho,message,topic,board,active,markedtimes) VALUES ('$reason','$usename','$message','$topic','$board','1','1')";
99 $result = mysql_query($sql);
100 echo "<font color=black>Thank you for marking this probably stupid and inane message. Return to from which you <a href=messagelist.php?board=".$board."&topic=".$topic."><font color=blue>came</font></a>.";
102 if (!$submit)
104 $sql = "SELECT * FROM boards WHERE boardid='$board'";
105 $result = mysql_query($sql);
106 $myrow = mysql_fetch_array($result);
107 $boardname = $myrow["boardname"];
108 $sql = "SELECT * FROM topics WHERE topicid='$topic'";
109 $result = mysql_query($sql);
110 $myrow = mysql_fetch_array($result);
111 $topicname = $myrow["topicname"];
112 $sql = "SELECT * FROM messages WHERE messageid='$message'";
113 $result = mysql_query($sql);
114 $myrow = mysql_fetch_array($result);
115 echo "<center><font color=black face=arial>Board: ".$boardname."<br>Topic Name: ".$topicname."</center>";
116 $thetime = timetime($myrow["messageid"]);
117 $mes = stripslashes($myrow["messbody"]);
118 echo "<br><table width=100%>";
119 printf("<tr><td bgcolor=".$secondcolor."><font face=arial><b>From: </b>%s | <b>Posted:</b> %s | <a href=modnotice.php?board=%s&topic=%s&message=%s>Mark</a> for moderation</font></td></tr><tr><td bgcolor=".$firstcolor."><font face=arial>%s</font></td></tr></table>", $myrow["messby"], $thetime, $board, $topic, $myrow["messageid"], $mes);
120 echo "<br><br><form method=post action=modnotice.php?board=<?= $board ?>&topic=<?= $topic ?>&message=<?= $message ?>>
121 <input type=radio name=reason value=1> <font color=black>Stupid.<br></font>
122 <input type=radio name=reason value=2> <font color=black>Annoying.<br></font>
123 <input type=radio name=reason value=3> <font color=black>Bad Language.<br></font>
124 <input type=radio name=reason value=5> <font color=black>Illegal.<br></font>
125 <Input type=radio name=reason value=4> <font color=black>Other:</font> <input type=text name=other><br><br>
126 <input type=submit name=submit Value=\"Mark this person.\">
127 </form>";