View difference between Paste ID: 7tfTe0kJ and ESY09psH
SHOW: | | - or go back to the newest paste.
1
<?php
2
/**
3
Created by TheMasterGeneral.
4
Forum Warning Mod.
5
Cost: FREE
6
File: /forumwarn.php
7
Info: This mod can be used to warn forum posters for doing actions.
8
The warning will be sent to their events. This mod will not
9
auto-ban, its just a way to warn users.
10
11
I expect this to be buggy and lacking security. If bugs arise, please report them
12
ASAP!!! Thanks!
13
14
Also, be sure to check out line #
15
you will need to edit in your game's
16
intials OR name. (You won't have to
17
if your game is abbreviated to CID)
18
19
Extra steps that need to be taken: Make sure to link this somewhere in your
20
staff panel. The page is set so that anyone with staff powers can use this
21
page. If you wish to have it set up like how mine is, open your smenu.php
22
and find:
23
&gt;  <a href='staff_punit.php?action=unmailform'>Un-Mailban User</a><br />
24
and under it, paste:
25
&gt; <a href='forumwarn.php'>Forum Warn</a><br />
26
27
 */
28
include"globals.php";
29
//Test for proper staff levels.
30
if ($ir['user_level'] <= 1)
31
	{
32
		echo 'You do not have permission to be here.';
33
		$h->endpage();
34
	}
35
//Continue
36
print'<h2>Forum Warning</h2>';
37
38
//To secure ID input.
39
//I don't know of any thing in MCC that has userids as something like 233.097
40-
$id= abs(intval($_POST['ID']));
40+
$id = abs(intval($_POST['ID']));
41
//Print the page.
42
//Escape the POST. This doesn't get inserted into the db and people are viewing it as well
43-
$_POST['Reason'] = $db->escape(trim($_POST['Reason']));
43+
$reason = $db->escape(trim($_POST['Reason']));
44
//Make sure they input a reason greater than maybe 5 chars?
45-
if(!isset($id) && strlen(trim($_POST['Reason'])) >= 5) {
45+
if(!isset($id) && strlen(trim($reason)) >= 5) {
46
print "Use to warn a user from the CID Forums. This will not auto-ban the user. Please remember that abusing this system will get you removed as staff
47
and you will be placed in the federal jail.<br><br><br><br>
48
<br>
49
<br>
50
<form action='forumwarn.php' method='post'>
51
User id: <input type='text' name='ID' />
52
<br>
53
<form action='forumwarn.php' method='post'>
54
Reason: <input type='text' name='Reason' /><br>
55
<br>
56
<input type='submit' value='Submit' />
57
</form>";
58
 
59
} else {
60-
$maxMembs = $db->fetch_row($db->query("SELECT COUNT(*) AS `u` FROM `users` WHERE `userid` = {$_POST['ID']}"));
60+
//No need to fetch the row you can just do a simple num_rows()
61-
if($_POST['ID'] > $maxMembs['u'])
61+
$mems = $db->query("SELECT `userid` FROM `users` WHERE `userid` = ".$id);
62
if($db->num_rows($mems) <= 0)
63
	{
64
		echo "Invalid ID specified. Try again.";
65
                //kill the script so it doesn't keep running
66
		exit($h->endpage());
67
	}
68-
event_add($_POST['ID'],"You have been warned from the CID Forums for the following reason: {$_POST['Reason']} </a> ",$c);
68+
69
event_add($id,"You have been warned from the CID Forums for the following reason: {$reason} ",$c);
70-
stafflog_add("Forum Warned User ID {$_POST['ID']} 
70+
71-
from the forums for {$_POST['Reason']}!");
71+
stafflog_add("Forum Warned User ID {$id} 
72
from the forums for {$reason}!");
73-
echo "User ID #{$_POST['ID']} has been forum warned for the following reason: 
73+
74-
<i>{$_POST['Reason']}</i>.
74+
echo "User ID #{$id} has been forum warned for the following reason: 
75
<i>{$reason}</i>.
76
<br><br>Please remember that abusing this system will get you removed as staff
77
and you will be placed in the federal jail.";
78
79
/**
80
Lines 63 and 64 couple lines aren't needed, but serve as
81
a warning for those who think its okay
82
to abuse this system. Abusing this system
83
won't really break the game, but its more
84
so abuse on the lines of harassment.
85
*/
86
87
88
}
89
$h->endpage();
90
?>