[Tool/Web/Other] [PHP] SA-MP Website Banlist Parser
#1

SA-MP Website Banlist Parser

The code is now cleaner, and simpler to a degree. Basically, this little script i have written for you all allows you to show your banlist on your website, and format it in any way you want.

For example, you could show the ip's of the 10 most recent bans.

Documentation

void Bans::__construct(string $fHost, string $fUser, string $fPass)
Parameters
$fHost - remote ftp host to connect to
$fUser - remote ftp username to connect to
$fPass - remote ftp password to connect to

string Bans::rawList(string $fVar)
Description
Reads banlist and returns it as a string with each ban on a new line
Parameters
$fVar - the file to read from

void Bans::cron(string $remote_file)
Description
Downloads banlist as 'samp.ban', good for cronjob
Parameters
$remote_file - the remote file to download (eg. 'samp03svr/samp.ban' or 'samp.ban')

string Bans:arseBan(string $format, bool $ASC=TRUE, int $LIMIT=0, bool $todayOnly=false)
Description
Formats the banlist and other select options in the way you wish
Parameters
$format - the specified format to use when formatting the banlist. format arguments:
#DATE - date of the ban
#DTIME - date and time of the ban, separated by a '-' in the middle
#TIME - time of the ban
#USER - display the username that was banned
#IP - display the ip that was banned
#BTYPE - type of ban issued (eg, range ban)
$ASC - toggle to display the ban list in ascending format, true will order it ascending
false will order the ban list descending
$LIMIT - limit of bans to print, 0 for unlimited
$todayOnly - display only todays bans, true will only show todays bans, false will show all


Download (Class + Example)
Heres a Live Example.

Setup
Extract the Bans.rar and upload it to your website or wherever you have a PHP parser installed and would like to display the bans.
Setup a cron job to run however often you like (i recommend every 20 or so minutes) and point it to your cron job script which calls the Bans::cron function, an example cron job script is included in the download (example_cron.php)

Examples
There are two example files included
example_index.php
example_cron.php

example_index.php is an example page which shows how the parser can be used to format your banlist
example_cron.php is an example cron job script, little editing is necessary.

Additionally, here are some more examples of Bans:arseBan function, as it's documented quite confusingly.

PHP код:
<?php
$Bans 
= new Bans("localhost""root""pass");
echo 
"<ul>";
echo 
$Bans->parseBan("<li>#USER(#IP) banned at #TIME, #DATE</li>"false10);
echo 
"</ul>";
?>
PHP код:
<?php
$Bans 
= new Bans("localhost""root""pass");
echo 
$Bans->parseBan("#USER was banned at #TIME on #DATE, #BTYPE"false).'<br/>';
?>
Reply


Messages In This Thread
[PHP] SA-MP Website Banlist Parser - by iLinx - 03.12.2009, 01:48
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by Christopher. - 03.12.2009, 15:27
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by Luka P. - 03.12.2009, 15:29
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by Joske_Vermeulen - 03.12.2009, 15:45
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by KKashimia - 03.12.2009, 16:59
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by iLinx - 03.12.2009, 20:00
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by kukars22 - 07.12.2009, 22:44
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by iLinx - 07.12.2009, 22:54
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by kukars22 - 07.12.2009, 23:02
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by iLinx - 07.12.2009, 23:07
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by kukars22 - 07.12.2009, 23:17
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by iLinx - 07.12.2009, 23:37
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by lolumadd - 08.12.2009, 01:16
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by Bayler - 18.01.2010, 01:53
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by iLinx - 18.01.2010, 02:04
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by Bayler - 18.01.2010, 02:17
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by kevinwalter - 18.01.2010, 17:25
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by thiaZ_ - 18.01.2010, 18:57
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by WardenCS - 19.01.2010, 04:51
Re: [PHP] Format your banlist [make it look however you want] (banlist parser cl - by RenisiL - 19.01.2010, 11:24
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by thiaZ_ - 29.01.2010, 12:45
Re: [PHP] Format your banlist [make it look however you want] (banlist parser class) - by thiaZ_ - 03.02.2010, 15:32
Re: [PHP] SA-MP Website Banlist Parser - by iLinx - 20.03.2010, 00:24
Re: [PHP] SA-MP Website Banlist Parser - by iLinx - 20.03.2010, 23:25
Re: [PHP] SA-MP Website Banlist Parser - by bpeterson - 25.03.2010, 18:12
Re: [PHP] SA-MP Website Banlist Parser - by iLinx - 27.03.2010, 17:00
Re: [PHP] SA-MP Website Banlist Parser - by coole210 - 23.05.2010, 03:17
Re: [PHP] SA-MP Website Banlist Parser - by park4bmx - 23.05.2010, 08:26
Re: [PHP] SA-MP Website Banlist Parser - by XmLmX2_RK - 16.07.2010, 15:05
Re: [PHP] SA-MP Website Banlist Parser - by androm - 03.11.2010, 20:37
Re: [PHP] SA-MP Website Banlist Parser - by M.5 - 29.08.2011, 08:48
Re: [PHP] SA-MP Website Banlist Parser - by mihan-888 - 31.12.2011, 08:18
Re: [PHP] SA-MP Website Banlist Parser - by kidor - 28.06.2012, 07:43
Respuesta: [PHP] SA-MP Website Banlist Parser - by javi - 21.08.2012, 09:45
Re: [PHP] SA-MP Website Banlist Parser - by Nikid - 09.02.2013, 01:24
Re: [PHP] SA-MP Website Banlist Parser - by John Rockie - 21.08.2013, 01:40
Re: [PHP] SA-MP Website Banlist Parser - by BlonduX - 14.08.2014, 18:55
Re: [PHP] SA-MP Website Banlist Parser - by Don_Cage - 21.08.2014, 09:33

Forum Jump:


Users browsing this thread: 3 Guest(s)