Raised This Month: $ Target: $400
 0% 

[ANY] Threaded Mysql Bans


Post New Thread Reply   
 
Thread Tools Display Modes
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-31-2012 , 14:29   Re: [ANY] Threaded Mysql Bans
Reply With Quote #31

Quote:
Originally Posted by Adjo View Post
as for a ban disappearing, the only time a delete query is ran is when the my_unban command is run from the console - it'll remove the record from the database then.
That's odd since I never ran the my_unban command ever. I know I had a 4th guy who was trade spamming on our server and banned him with that reason but it's simply gone from the database now. I'm the only admin on our server so I know it's not possible for maybe another admin to unban him.

I'm not sure what happened to his entry but I just looked at the database locally via the mysql command line and everyone but him are listed. It's a mystery.
Jim E. Rustler is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-31-2012 , 20:43   Re: [ANY] Threaded Mysql Bans
Reply With Quote #32

Here's an update to the webpage. Added a bit more styling.

PHP Code:
<?php
    
    $config    
=    array(
        
'host'        =>    'localhost',        //Database host
        
'username'    =>    'username',        //Database username
        
'password'    =>    'password',        //Database password
        
'dbname'    =>    'database',        //Database name
        
        
'perpage'    =>    20,                    //Amount of bans to show per page
    
);
    
    
//---------
    
    
mysql_connect($config['host'], $config['username'], $config['password']) or die('Couldn\'t connect to the database.');
    
mysql_select_db($config['dbname']) or die('Couldn\'t select the database.');
    
    
$currentPage = empty($_GET['page'])||!is_numeric($_GET['page'])||$_GET['page']<1?1:(int)$_GET['page'];
    
$query mysql_query('SELECT * FROM `my_bans` ORDER BY `id` DESC LIMIT '.(($currentPage-1)*$config['perpage']).','.$config['perpage']);
    
$pageResults mysql_num_rows(mysql_query('SELECT * FROM `my_bans`'));
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
<title>MySQL Bans</title>
<style type="text/css">
body {
    background: #fff;
}

#table-b
{
    font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
    font-size: 12px;
    margin: 45px;
    width: 480px;
    text-align: left;
    border-collapse: collapse;
    border: 1px solid #69c;
}
#table-b th
{
    padding: 15px 10px 10px 10px;
    font-weight: normal;
    font-size: 14px;
    color: #039;
}
#table-b tbody
{
    background: #e8edff;
}
#table-b td
{
    padding: 10px;
    color: #669;
    border-top: 1px dashed #fff;
}
#table-b tbody tr:hover td
{
    color: #339;
    background: #d0dafd;
}

tfoot {
    display: table-footer-group;
    border-color: inherit;
    text-align: left;
}
</style>
    </head>

        <?php
            
if(mysql_num_rows($query) == 0){
                echo 
'No players currently on the banlist...';
            }else{
        
?>
<table id="table-b">
<thead>
<tr>
<th scope="col">Steam ID:</th>
<th scope="col">Player Name:</th>
<th scope="col">Ban Reason:</th>
<th scope="col">Banned By:</th>
<th scope="col">Ban Length:</th>
<th scope="col">Time:</th>
</tr>
</thead>

<tfoot>
        <tr>
            <td colspan="5"><em>Pagination would look good here, except I know not how to do it.</em></td>
<td class="tfoot">&nbsp;</td>
        </tr>
    </tfoot>
        <?php
                
while($row mysql_fetch_assoc($query)){
                    echo 
'<tr><td>',$row['steam_id'],'</td><td>',htmlentities($row['player_name'], ENT_QUOTES"UTF-8"),'</td><td>',htmlentities($row['ban_reason']),'</td><td>',htmlentities($row['banned_by'], ENT_QUOTES"UTF-8"),'</td><td>',$row['ban_length'],'</td><td>',$row['timestamp'],'</td></tr>';
                }
                echo 
'</table>';
                if(
$pageResults>$config['perpage']){
                    
$pageUrl '?page=';
                    if(
$currentPage>1){
                        echo 
'<a href="',$pageUrl,($currentPage-1),'">Previous</a>&nbsp;';
                    }
                    
$totalPages ceil($pageResults/$config['perpage']);
                    for(
$i=1;$i<=$totalPages;++$i){
                        echo 
'<a href="',$pageUrl,$i,'">',$i,'</a>&nbsp;';
                    }
                    if(
$currentPage<$totalPages){
                        echo 
'<a href="',$pageUrl,($currentPage+1),'">Next</a>&nbsp;';
                    }
                }
            }
        
?>
    </body>
</html>
I do not know how to put the pagination stuffs in the table footer, so if someone can fix that up it'll be even better.
Jim E. Rustler is offline
rautamiekka
Veteran Member
Join Date: Jan 2009
Location: Finland
Old 08-01-2012 , 08:39   Re: [ANY] Threaded Mysql Bans
Reply With Quote #33

I'd save just the part after 'STEAM_' instead of the whole ID.
__________________
Links to posts I received Karma from:
Big thanks to all who gave Karma
rautamiekka is offline
Send a message via ICQ to rautamiekka Send a message via AIM to rautamiekka Send a message via MSN to rautamiekka Send a message via Yahoo to rautamiekka Send a message via Skype™ to rautamiekka
Adjo
Member
Join Date: Dec 2009
Location: UK
Old 08-01-2012 , 11:55   Re: [ANY] Threaded Mysql Bans
Reply With Quote #34

Quote:
Originally Posted by Jim E. Rustler View Post
I do not know how to put the pagination stuffs in the table footer, so if someone can fix that up it'll be even better.
This should do it for you:
PHP Code:
<?php
    
    $config    
=    array(
        
'host'        =>    'localhost',        //Database host
        
'username'    =>    'username',        //Database username
        
'password'    =>    'password',        //Database password
        
'dbname'    =>    'database',        //Database name
        
        
'perpage'    =>    20,                    //Amount of bans to show per page
    
);
    
    
//---------
    
    
mysql_connect($config['host'], $config['username'], $config['password']) or die('Couldn\'t connect to the database.');
    
mysql_select_db($config['dbname']) or die('Couldn\'t select the database.');
    
    
$currentPage = empty($_GET['page'])||!is_numeric($_GET['page'])||$_GET['page']<1?1:(int)$_GET['page'];
    
$query mysql_query('SELECT * FROM `my_bans` ORDER BY `id` DESC LIMIT '.(($currentPage-1)*$config['perpage']).','.$config['perpage']);
    
$pageResults mysql_num_rows(mysql_query('SELECT * FROM `my_bans`'));
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>MySQL Bans</title>
        <style type="text/css">
            body{
                background: #fff;
            }

            #table-b{
                font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
                font-size: 12px;
                margin: 45px;
                width: 480px;
                text-align: left;
                border-collapse: collapse;
                border: 1px solid #69c;
            }
            
            #table-b th{
                padding: 15px 10px 10px 10px;
                font-weight: normal;
                font-size: 14px;
                color: #039;
            }
            
            #table-b tbody{
                background: #e8edff;
            }
            
            #table-b td{
                padding: 10px;
                color: #669;
                border-top: 1px dashed #fff;
            }
            
            #table-b tbody tr:hover td{
                color: #339;
                background: #d0dafd;
            }

            tfoot{
                display: table-footer-group;
                border-color: inherit;
                text-align: left;
            }
        </style>
    </head>
    <body>
        <?php
            
if(mysql_num_rows($query) == 0){
                echo 
'No players currently on the banlist...';
            }else{
        
?>
        <table id="table-b">
            <thead>
                <tr>
                    <th scope="col">Steam ID:</th>
                    <th scope="col">Player Name:</th>
                    <th scope="col">Ban Reason:</th>
                    <th scope="col">Banned By:</th>
                    <th scope="col">Ban Length:</th>
                    <th scope="col">Time:</th>
                </tr>
            </thead>

            <tfoot>
                <tr>
                    <td colspan="5">
                    <?php
                        
if($pageResults>$config['perpage']){
                            
$pageUrl '?page=';
                            if(
$currentPage>1){
                                echo 
'<a href="',$pageUrl,($currentPage-1),'">Previous</a>&nbsp;';
                            }
                            
$totalPages ceil($pageResults/$config['perpage']);
                            for(
$i=1;$i<=$totalPages;++$i){
                                echo 
'<a href="',$pageUrl,$i,'">',$i,'</a>&nbsp;';
                            }
                            if(
$currentPage<$totalPages){
                                echo 
'<a href="',$pageUrl,($currentPage+1),'">Next</a>&nbsp;';
                            }
                        }
                    
?>
                    </td>
                    <td class="tfoot">&nbsp;</td>
                </tr>
            </tfoot>
        <?php
                
while($row mysql_fetch_assoc($query)){
                    echo 
'<tr><td>',$row['steam_id'],'</td><td>',htmlentities($row['player_name'], ENT_QUOTES"UTF-8"),'</td><td>',htmlentities($row['ban_reason']),'</td><td>',htmlentities($row['banned_by'], ENT_QUOTES"UTF-8"),'</td><td>',$row['ban_length'],'</td><td>',$row['timestamp'],'</td></tr>';
                }
                echo 
'</table>';
            }
        
?>
    </body>
</html>
Adjo is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 08-01-2012 , 13:18   Re: [ANY] Threaded Mysql Bans
Reply With Quote #35

Looks good Adjo thanks!

I swear this plugin isn't capture some bans. I've banned a guy just now for intel griefing and he isn't listed in the database at all.

Wolfy - disconnected (You have been Banned for "intel griefing"). Showed up on screen but this guy simply is not showing up for reasons I know nothing about :/
Jim E. Rustler is offline
senseit
Member
Join Date: Aug 2009
Old 08-03-2012 , 04:07   Re: [ANY] Threaded Mysql Bans
Reply With Quote #36

Quote:
Originally Posted by Jim E. Rustler View Post
Looks good Adjo thanks!

I swear this plugin isn't capture some bans. I've banned a guy just now for intel griefing and he isn't listed in the database at all.

Wolfy - disconnected (You have been Banned for "intel griefing"). Showed up on screen but this guy simply is not showing up for reasons I know nothing about :/

I've not been able to duplicate any problems.

The only bans that will delete themselves, is if the ban is timed, and the user reconnects after the ban expires.

You're saying you used my_ban and the ban is not appearing?
senseit is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 08-03-2012 , 08:53   Re: [ANY] Threaded Mysql Bans
Reply With Quote #37

Quote:
Originally Posted by senseit View Post
I've not been able to duplicate any problems.

The only bans that will delete themselves, is if the ban is timed, and the user reconnects after the ban expires.

You're saying you used my_ban and the ban is not appearing?
Yes, I removed basebans and change this plugins command from my_ban to ban. It works great for replacing sourcemods built-in ban system but I noticed the bug where people are randomly removed from the DB even though they were permanently banned. We never use timed bans on our server, it's perma all the way with every ban.

EDIT: Just had another permanent ban go missing from the database. Can we get a version that doesn't remove bans automatically?

Last edited by Jim E. Rustler; 08-03-2012 at 18:08.
Jim E. Rustler is offline
senseit
Member
Join Date: Aug 2009
Old 08-04-2012 , 00:45   Re: [ANY] Threaded Mysql Bans
Reply With Quote #38

Quote:
Originally Posted by Jim E. Rustler View Post
Yes, I removed basebans and change this plugins command from my_ban to ban. It works great for replacing sourcemods built-in ban system but I noticed the bug where people are randomly removed from the DB even though they were permanently banned. We never use timed bans on our server, it's perma all the way with every ban.

EDIT: Just had another permanent ban go missing from the database. Can we get a version that doesn't remove bans automatically?
Try the version attached

Last edited by senseit; 08-11-2012 at 21:13.
senseit is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 08-04-2012 , 14:53   Re: [ANY] Threaded Mysql Bans
Reply With Quote #39

Quote:
Originally Posted by senseit View Post
Try the version attached
Does this version leave even expired banned players in the DB? If so, thanks!
Jim E. Rustler is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 08-05-2012 , 10:04   Re: [ANY] Threaded Mysql Bans
Reply With Quote #40

I've noticed something. I just had to ban 2 guys from our server and the first guy I banned his ban message never showed at all the "You have been Banned for.." but the 2nd guy I banned it DID show the "You have been Banned for.." message. Looked at the database and it's only showing a record for the guy that I banned that it showed the message for and the 1st guy isn't in the database at all.

Not sure what's up with that.
Jim E. Rustler is offline
Reply



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 23:50.


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