Raised This Month: $32 Target: $400
 8% 

[ANY] Threaded Mysql Bans


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

I can understand you'd want to not make it another sourcebans but a small page to query the database and print out a list of who is banned, by whom and for what reason for reference really isn't all that difficult or over doing things in my opinion. If anything it makes things a lot easier for anyone who wanted to use this since they'd not have to login to the MySQL database and run a statement to find someones ban that wants to protest.

It doesn't have to be anything fancy like do bans or kicks and such FROM the web interface. Just a simple output of the contents in the db would be good. Oh well.

Last edited by Jim E. Rustler; 07-29-2012 at 07:13.
Jim E. Rustler is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-29-2012 , 11:03   Re: [ANY] Threaded Mysql Bans
Reply With Quote #12

unknown command: my_ban
Jim E. Rustler is offline
senseit
Member
Join Date: Aug 2009
Old 07-29-2012 , 11:11   Re: [ANY] Threaded Mysql Bans
Reply With Quote #13

Quote:
Originally Posted by Jim E. Rustler View Post
unknown command: my_ban
There was an error on boot. Make sure your database is setup correctly.
senseit is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-29-2012 , 11:15   Re: [ANY] Threaded Mysql Bans
Reply With Quote #14

Quote:
Originally Posted by senseit View Post
There was an error on boot. Make sure your database is setup correctly.
Does this require an entire server restart? We've changed maps since we last loaded the plugin in hopes that it would re-read the database.cfg but we are still getting the unknown command: my_ban problem. The database itself is fine.

I'm not sure where this is getting it's user/pass from.. certainly not database.cfg because I have the username/password and all of that setup correctly in there but here are the errors I get:

Code:
L 07/29/2012 - 11:26:48: SourceMod error session started
L 07/29/2012 - 11:26:48: Info (map "ctf_2fort") (file "errors_20120729.log")
L 07/29/2012 - 11:26:48: [mysqlt_bans.smx] [MYBans] Could Not Connect to Database, error: [1045]: Access denied for user 'root'@'localhost' (using password: NO)
L 07/29/2012 - 11:27:05: [mysqlt_bans.smx] [MYBans] Database Connection Error: [1045]: Access denied for user 'root'@'localhost' (using password: NO)
L 07/29/2012 - 11:27:35: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 07/29/2012 - 11:27:35: [SM] Displaying call stack trace for plugin "mysqlt_bans.smx":
L 07/29/2012 - 11:27:35: [SM]   [0]  Line 95, /home/groups/alliedmodders/forums/files/5/8/2/6/8/106979.attach::OnClientPostAdminCheck()
L 07/29/2012 - 11:28:06: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 07/29/2012 - 11:28:06: [SM] Displaying call stack trace for plugin "mysqlt_bans.smx":
L 07/29/2012 - 11:28:06: [SM]   [0]  Line 95, /home/groups/alliedmodders/forums/files/5/8/2/6/8/106979.attach::OnClientPostAdminCheck()
L 07/29/2012 - 11:28:30: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 07/29/2012 - 11:28:30: [SM] Displaying call stack trace for plugin "mysqlt_bans.smx":
L 07/29/2012 - 11:28:30: [SM]   [0]  Line 95, /home/groups/alliedmodders/forums/files/5/8/2/6/8/106979.attach::OnClientPostAdminCheck()
L 07/29/2012 - 11:28:41: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 07/29/2012 - 11:28:41: [SM] Displaying call stack trace for plugin "mysqlt_bans.smx":
L 07/29/2012 - 11:28:41: [SM]   [0]  Line 136, /home/groups/alliedmodders/forums/files/5/8/2/6/8/106979.attach::Command_Ban()
L 07/29/2012 - 11:29:11: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 07/29/2012 - 11:29:11: [SM] Displaying call stack trace for plugin "mysqlt_bans.smx":
L 07/29/2012 - 11:29:11: [SM]   [0]  Line 136, /home/groups/alliedmodders/forums/files/5/8/2/6/8/106979.attach::Command_Ban()

Database is fine..
Code:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| mysqlbans          |
| sourcebans         |
+--------------------+
4 rows in set (0.05 sec)
database.cfg is fine..
Code:
"Databases"
{
	"driver_default"		"mysql"
	
	// When specifying "host", you may use an IP address, a hostname, or a socket file path

	"default"
	{
		"driver"			"mysql"
		"host"				"localhost"
		"database"			"sourcemod"
		"user"				"myaccount"
		"pass"				"mypassword"
	}

	"mysqlbans"
	{
		"driver"			"mysql"
		"host"				"localhost"
		"database"			"mysqlbans"
		"user"				"user"
		"pass"			"pass"
		//"timeout"			"0"
		"port"			"3306"
	}
}

Last edited by Jim E. Rustler; 07-29-2012 at 11:39.
Jim E. Rustler is offline
senseit
Member
Join Date: Aug 2009
Old 07-29-2012 , 11:42   Re: [ANY] Threaded Mysql Bans
Reply With Quote #15

Re-read instructions. You didn't setup the database correctly. Plugin uses default database. Look at the error you posted. Login/password error when connecting to the DB. It's pretty self-explanatory.

Last edited by senseit; 07-29-2012 at 11:42.
senseit is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-29-2012 , 11:43   Re: [ANY] Threaded Mysql Bans
Reply With Quote #16

Quote:
Originally Posted by senseit View Post
Re-read instructions. You didn't setup the database correctly. Plugin uses default database. Look at the error you posted. Login/password error when connecting to the DB. It's pretty self-explanatory.
So the database has to be named 'default'? Sorry, I'm not following.
Jim E. Rustler is offline
senseit
Member
Join Date: Aug 2009
Old 07-29-2012 , 11:44   Re: [ANY] Threaded Mysql Bans
Reply With Quote #17

Quote:
Originally Posted by Jim E. Rustler View Post
So the database has to be named 'default'? Sorry, I'm not following.
Correct
senseit is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-29-2012 , 11:46   Re: [ANY] Threaded Mysql Bans
Reply With Quote #18

so the database I created 'mysqlbans' will not work unless I rename it to 'default' and re-do everything?
Jim E. Rustler is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 07-29-2012 , 12:05   Re: [ANY] Threaded Mysql Bans
Reply With Quote #19

senseit, it wouldn't be too difficult to get a cvar for clients that lets them pick their database, with the cvar defaulted to "default"
__________________
thetwistedpanda is offline
Jim E. Rustler
BANNED
Join Date: Jul 2012
Old 07-29-2012 , 12:13   Re: [ANY] Threaded Mysql Bans
Reply With Quote #20

I'm no expert in PHP so this is probably going to get laughed at. But I attempted to make a PHP page that shows bans.

PHP Code:
<html>
<head>
<title>MySQL Bans</title>

    <style type="text/css">
        body {
            font-family: Trebuchet MS, Helvetica, sans-serif;
            margin-left: auto;
            margin-right: auto;
        }
table, th, td
{
border: 1px solid black;
}
</style>

</head>

<body>
<?php
$username
="username";
$password="password";
$database="database";

mysql_connect(localhost,$username,$password);
@
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM my_bans";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>

<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td>Steam ID:</td>
<td>Player Name:</td>
<td>Ban Reason:</td>
<td>Banned By:</td>
<td>Ban Length:</td>
<td>Time:</td>
</tr>

<?php
$i
=0;
while (
$i $num) {

$f1=mysql_result($result,$i,"steam_id");
$f2=mysql_result($result,$i,"player_name");
$f3=mysql_result($result,$i,"ban_reason");
$f4=mysql_result($result,$i,"banned_by");
$f5=mysql_result($result,$i,"ban_length");
$f6=mysql_result($result,$i,"timestamp");

?>

<tr>
<td><?php echo $f1?></td>
<td><?php echo $f2?></td>
<td><?php echo $f3?></td>
<td><?php echo $f4?></td>
<td><?php echo $f5?></td>
<td><?php echo $f6?></td>

<?php
$i
++;
}
?>

</body>
</html>
EDIT: something I just noticed. I've been banning myself to test this plugin and my php page but I just banned a friend and instead of banning him it banned me lol. I'm positive I banned his name and not my own as my PHP page is showing I banned him and even has his correct steamid but I'M THE ONE BANNED! Funny bug I think.

Last edited by Jim E. Rustler; 07-29-2012 at 13:28.
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 13:10.


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