Jump to content
Sign in to follow this  
Huskies xD

Web based Rcon player banning system

Recommended Posts



I wanted to release a few scripts for ArmA 3 and other web based supporting applications, I know it can be very hard for some people to start programming or even if they are not into that side of things, but would still like features for their community.


I want to make it easy for people and I know allot of programmers and/or scripters do not want to support communities or they just want money for it.


The following is a web based application intended for ArmA 3 servers, (but could be used for anything that uses the bans.txt file), this web based application has a form that submits to a database, then a script is run via task scheduler or crontab (Linux) and forwards said bans from the database to the infamous, bans.txt file.


First lets see how we can run a scheduled task on windows (most popular);




Program/Script: C:\Xampp\php\php.exe -f C:\Xampp\htdocs\my_script.php



If you are on (or using) a Linux system, you could do the following;




This command will take you to a Task scheduler the Linux equivalent.


Paste this in, editing it with the path to the script.



*/1 * * * * php -q /www/web_dir/writebans.php


This Task will run every one minute.



Now comes the juicy part, here are all the scripts you will need, unfortunately I am not going into details on how to install them all, anyone with common knowledge will know what they are doing with these, of course you can always get a friend.


Banform.html File:

<form name="banplayer" role="form" method="post" action="PageHere.php">
        <div class="form-group">
        <input type='hidden' name='playerid' id='playerid' value='CODE HERE'/><br>
        <input type='hidden' name='rpName' id='rpName' value='CODE HERE'/>
        <input type='hidden' name='steamID' id='steamID' value='CODE HERE'/>
        <input type='hidden' name='guid' id='guid' value='CODE HERE'/>
        <input type='hidden' name='staffName' id='staffName' value='CODE HERE'/>
        <input type="datetime-local" id="length" >
        <textarea rows="3" cols="80" placeholder="Evidence" type="text" id="reason"></textarea><br>
        <textarea rows="3" cols="80" placeholder="Internal moderator notes" type="text" id="notes"></textarea><br>
        <input type="submit" value="Submit Ban" name="submit" />

<script type="text/javascript">
$( "#lengthPerm" ).change(function() {
    if ($("#lengthPerm").is(":checked")) {
    } else {

BanForm.php File:


// Display data from DB to site safely
function displayData($data) {
    $data = addslashes($data);
    $data = htmlentities($data, ENT_QUOTES, 'utf-8');
    $data = filter_var($data, FILTER_SANITIZE_STRING);
    $data = html_entity_decode($data);
    return $data;

$steamID = displayData($_POST['steamID']);

for ($i = 0; $i < 8; $i++) {
  $temp .= chr($steamID & 0xFF);
  $steamID >>= 8;

$steamID = md5('BE' . $temp);

$rpName = displayData($_POST['rpName']);
$guid = displayData($_POST['guid']);
$length = displayData($_POST['length']);
$evid = displayData($_POST['reason']);
$notes = displayData($_POST['notes']);
$staffName = displayData($_POST['staffName']);
$created = time();

$sql = "SELECT id FROM bans ORDER BY id DESC LIMIT 1;";
$result = mysqli_query($link, $sql) or die (mysqli_error($link));;
$num = mysqli_fetch_array($result);

$num = displayData($num['id']);
$num = $num + 1;

$reason = "Community Name - BANID #" . $num . " - Appeal at www.CommunityLinkHere.com";

$sql = "INSERT INTO bans (`name`, `steamid`, `guid`, `length`, `created`, `reason`, `evid`, `notes`, `active`, `staff`, `banid`) VALUES
('$rpName', '$steamID', '$guid', '$timeLength', '$created', '$reason', '$evid', '$notes', 1, '$staffName', '$num');";

mysqli_query($link, $sql) or die (mysqli_error($link));;


WriteBans.php File, this is the file that makes this possible, this will be the file that needs running from the Task scheduler:


$file = "bans.txt";
$f = fopen($file, 'w'); // Open in write mode

$sql = mysqli_query($db, "SELECT * FROM bans ORDER BY id DESC");

while($row = mysqli_fetch_array($sql)){

if($row['guid'] !== '' AND $row['length'] !== ''){

		if($row['active'] == 1){

		    $a = $row['guid'];

				if($row['length'] == 'PERM'){

					$b = '-1';


					$b = $row['length'];

		    $c = $row['reason'];

		    $bans = "$a $b $c\n";

		    fwrite($f, $bans);






And last but certainly not least, the SQL Table structure:

	`name` VARCHAR(255) NOT NULL,
	`steamid` VARCHAR(255) NOT NULL,
	`guid` VARCHAR(255) NOT NULL,
	`length` VARCHAR(255) NOT NULL,
	`created` VARCHAR(255) NOT NULL,
	`reason` TEXT NOT NULL,
	`evid` TEXT NOT NULL,
	`active` INT(11) NOT NULL DEFAULT '1',
	`staff` VARCHAR(255) NOT NULL,
	`rby` VARCHAR(255) NOT NULL DEFAULT 'na',
	`banid` INT(11) NOT NULL,

... And thats all she wrote for now.



I am open for questions, but I must warn you, that I am busy allot of the time, my steam profile is linked to my forum account, you can find allot of contact information on their, including where I work at the moment. Thank guys and I hope this helps you out and makes your communities grow into something special.


Also a thank you to Matthew for help with the Func and idea for SQL.

  • Like 1

Share this post

Link to post
Share on other sites


Edited by simzors

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this