Raised This Month: $ Target: $400
 0% 

Release Legacy SourceBans 1.4.11 (Updated 2014/02/17)


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Dirton
BANNED
Join Date: Oct 2008
Old 09-20-2009 , 14:11   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1891

Quote:
Originally Posted by krolus View Post
Dirton, you need just take away admin rights from deaf admins
Never mind, I programmed it myself. I decided to share it with the community in case if anyone wants it. Now, what this baby do:
1) Removes all bans older then 'ban_trashold' value and not having any demo assigned to them and have not been made by console to provide compatibility with KAC.
2) Removes all database ban demo lines that don't have actual ban assigned to it. Also remove demo files assigned to them.
3) Removes all unassigned ban comments.

The php file should be put inside the ‚demos‘ folder inside the sourcebans web page. You can execute it with any schedule program using the PHP.exe file.
PHP Code:
<?php
//==================Config==================================
$debug FALSE;
$ban_trashold 86400// Delete bans older then value in seconds
$host 'localhost';
$user 'root';
$pass '';
$db_name 'ultrashot_sourcebans';
$table_prefix 'sb';
//==========================================================

function next_comment() {
    global 
$row_comments;
    global 
$result_comments;
    global 
$comment_id;
    global 
$comments_left;
    
$temp $comment_id;
    while (
$comment_id == $temp) {
        if (
$row_comments = @mysql_fetch_assoc($result_comments)) $comment_id $row_comments['bid'];
        else {
            
$comments_left FALSE;
            return (
FALSE);
            }
        }
    return (
TRUE);
}

function 
next_demo() {
    global 
$row2;
    global 
$result2;
    global 
$demo_id;
    global 
$demos_left;
    if (
$row2 = @mysql_fetch_assoc($result2)) $demo_id $row2['demid'];
    else {
        
$demos_left FALSE;
        return (
FALSE);
        }
    return (
TRUE);
}

echo 
"<b>Netvarkingai uždėti banai buvo pašalinti...<b><br>Dėkojame už aktyvumą!<br>";
$demos_left TRUE;
$comments_left TRUE;
if(
$debug == TRUE) {
    echo 
'<table>';
        echo 
'<tr>';
            echo 
'<th>Ban ID</th>';
            echo 
'<th>Nick name</th>';
            echo 
'<th>Demo name/Baned by</th>';
        echo 
'</tr>';
    }
$db_conn = @mysql_connect($host,$user,$pass);
@
mysql_select_db($db_name);
$result = @mysql_query 'SELECT * FROM `'.$table_prefix.'_bans` ORDER BY `'.$table_prefix.'_bans`.`bid` ASC'$db_conn );
$result2 = @mysql_query 'SELECT * FROM `'.$table_prefix.'_demos` WHERE demtype LIKE '."'b'".' ORDER BY `demid`'$db_conn );
$result_comments = @mysql_query 'SELECT * FROM `'.$table_prefix.'_comments` WHERE type LIKE '."'B'".' ORDER BY `bid`'$db_conn );
$row2 = @mysql_fetch_assoc($result2);
$demo_id $row2['demid'];
next_comment();
if ( @
mysql_num_rows($result) > ) {
    while ( 
$row = @mysql_fetch_assoc($result)) {
        
$banid $row['bid'];
            if (
$comments_left == TRUE) while ($comment_id $banid) {
            
mysql_query('DELETE FROM `'.$table_prefix.'_comments` WHERE bid='.$comment_id.' AND `type` LIKE '."'B'");
            if(!
next_comment()) break;
            }
        if (
$demos_left == TRUE) while ($banid $demo_id) {
            
$myFile $row2['filename'];
            
unlink($myFile);
            
mysql_query('DELETE FROM `'.$table_prefix.'_demos` WHERE demid=$demo_id AND `demtype` LIKE '."'b'");
            if(!
next_demo()) break;
            }
        if (
$banid == $demo_id) {
            if(
$debug == TRUE) {
                echo 
"<tr><td>$banid</td>";
                echo 
"<td>".$row['name']."</td>";
                echo 
"<td><b>".$row2['origname']."</b></td></tr>";
                }
            
next_demo();
            if (
$comment_id == $banidnext_comment();
            }
        else if (
$row['aid'] == '0') {
            if(
$debug == TRUE) {
                echo 
"<tr><td>$banid</td>";
                echo 
"<td>".$row['name']."</td>";
                echo 
"<td>console</td></tr>";
                }
            if (
$comment_id == $banidnext_comment();
            }
        else {
            
$ban_age time() - $row['created'];
            if (
$ban_age >= $ban_trasholdmysql_query("DELETE FROM sb_bans WHERE bid=$banid");
            }
        }
    }
mysql_close $db_conn );
if(
$debug == TRUE) echo '</table>';
?>
I don't have much experience as programmer, but none the less I pretty much tested script in different conditions. One thing what I don't guaranty it will work with, with empty tables. Infect it'll fail miserably, but I don’t really care for that now. Write me a pm if any bugs found.

Last edited by Dirton; 09-21-2009 at 02:20.
Dirton is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-20-2009 , 18:34   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1892

Hi Dirton,

would be enough to unban the ban instead of deleting it, so comments etc are still there for history reasons.

You don't use the $table_prefix in the last query and your $ban_trashold config isn't used in the same line.

Normally there shouldn't be any demos or comments in the database without the holding ban unless you're working directly with the database instead of the webpanel, so the main purpose of your script could be reduced to:

PHP Code:
<?php
//==================Config==================================
$ban_trashold 86400// Delete bans older then value in seconds
//==========================================================

require_once("init.php");
require_once(
"includes/system-functions.php");


$banswodemo $GLOBALS['db']->GetAll('SELECT b.bid, b.name, (UNIX_TIMESTAMP()-b.created) AS age FROM `'.DB_PREFIX.'_bans` AS b WHERE b.aid > 0 AND b.RemoveType IS NULL AND (UNIX_TIMESTAMP()-b.created)>= '.$ban_trashold.' AND NOT EXISTS (SELECT d.demid FROM `'.DB_PREFIX.'_demos` AS d WHERE d.demid = b.bid)');

$trash_string SecondsToString($ban_trashold);
echo 
"Checking for bans which have been without a demo for {$trash_string}.<br /><table border=1>";
$uReason "[Auto Unban] No demo for {$trash_string}.";
foreach (
$banswodemo as $ban) {
    
$GLOBALS['db']->Execute("UPDATE `".DB_PREFIX."_bans` SET
                            `RemovedBy` = 0,
                            `RemoveType` = 'U',
                            `RemovedOn` = UNIX_TIMESTAMP(),
                            `ureason` = ?
                            WHERE `bid` = ?;"
,
                            array(
$uReason$ban['bid']));
    echo 
"<tr><td>" $ban['name'] . "</td><td>".SecondsToString($ban['age']) . " without a demo.</td></tr>";
}
$num sizeof($banswodemo);
echo 
"</table>$num bans has been unbanned.";
?>
__________________
Peace-Maker is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 09-20-2009 , 18:44   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1893

something is still wrong... i can't ban anyone with a client command... only works as rcon command.

I am in the sb database as admin, i have root admin on the server.

Everyone else can ban just fine.

When i do it, it just kicks the person, and puts a 5min internal ban on them like they got caught reconnecting.

nothing wrong with my setup

something is wrong with the coding
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
DontWannaName
Veteran Member
Join Date: Jun 2007
Location: VALVe Land, WA
Old 09-20-2009 , 21:34   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1894

Do you have unban enabled in the config?
__________________

DontWannaName is offline
Dirton
BANNED
Join Date: Oct 2008
Old 09-21-2009 , 02:33   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1895

Quote:
Originally Posted by Peace-Maker View Post
Hi Dirton,
Thanks, I kind of misted that value with all those rollbacks while writing the script. Now it's there.
Thanks, I kinda misssted that value with version backups rollbacks while writing the script. Now it's there.
Quote:
Originally Posted by Peace-Maker View Post
Hi Dirton,
would be enough to unban the ban instead of deleting it, so comments etc are still there for history reasons.
As for bans. I don't really need bans without demos, since it's mainly trash for reasons as occasional team killing, flashing, bad names or words. I don't think I need that information. What I care mostly about is cheats. Also if I simply unban those bans, it could be easily rebanned by its author, and I don't want that. Of course it would be unbanned next run, but how needs it....
Quote:
Originally Posted by Peace-Maker View Post
Hi Dirton,
Normally there shouldn't be any demos or comments in the database without the holding ban unless you're working directly with the database instead of the webpanel, so the main purpose of your script could be reduced to...
And I'm using SB for more than a year, and there were some demos in the database without bans. And that I think was because it ran some time on unix, which, if according to change log had problem deleting those appropriately until fixed in version 1.4.5 and that cause script to crash. None the less it'll work now in any situation.

Last edited by Dirton; 09-21-2009 at 02:54.
Dirton is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 09-21-2009 , 02:45   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1896

Quote:
Originally Posted by DontWannaName View Post
Do you have unban enabled in the config?
that's not it.. never was it


i submitted a bug to them, and they closed it, even though it's not fixed.
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
Izum
Junior Member
Join Date: Jun 2009
Location: Russia, Stalingrad
Old 09-22-2009 , 03:25   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1897

Please help.

Updater error:

Setup...

  • Checking current database version... 219
    Updating database to version: 295
Updating...

  • Running update: v241... Error executing: /updater/data/241.php. Stopping Update!
    Update Failed.
Izum is offline
Send a message via ICQ to Izum
DontWannaName
Veteran Member
Join Date: Jun 2007
Location: VALVe Land, WA
Old 09-22-2009 , 05:52   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1898

You sure that files there?
__________________

DontWannaName is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 09-22-2009 , 06:09   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1899

1) Scroll to the top of this page.
2) Click on "Search this Thread".
3) Type "v241".
4) ???
5) Profit.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
octo-dhd
Member
Join Date: Jan 2008
Location: Southern California
Old 09-22-2009 , 11:39   Re: SourceBans 1.4.5 (Updated 09/17/09)
#1900

Quote:
Originally Posted by ulx View Post
its: Fatal error: Call to undefined function timezone_abbreviations_list() in /srv/www/vhosts/xxx/xxx/xxx/init.php on line 270

how can I enable that on PHP 5.1.2? updating PHP isn't possible at the moment.

or change line 266 to something like....

if((version_compare(PHP_VERSION, "5") != -1) && function_exists(timezone_abbreviations_list))
__________________
Admin of the TF2 Newbs Server's
octo-dhd is offline
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode