Raised This Month: $51 Target: $400
 12% 

SQL Log Admin Connect


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Event Related       
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 12-30-2010 , 08:01   SQL Log Admin Connect
Reply With Quote #1

SQL Log Admin Connect
Authors: Dark_Style & Kostov
Version: 1.4

Description:

The plugin logs the admin connection into SQL. Server, date/time, and his name will be logged. The archive includes .php file.



Web Part:

If you want the information to be showed into your web site, you will need to include the .php file.

PHP Code:

include "./directory/sql_log_admin.php"
Modules:
PHP Code:
#include <sqlx> 
Cvars:

lac_host "" - host
lac_user "" - user
lac_pass "" - password
lac_db "" - database
lac_table "" - table
lac_prefix "" - Prefix for the messages.
lac_log_info 1/2 - What info to be logged. 1 - name; 2 - name and steamid.
( The SQL settings )

Changelog:
Code:
1.4 - Added new cvar for the logging information. Check out the cvars.
1.3 - Added new cvar for the prefix of messages.
1.2 :

- The plugin is fully rewritten.
- Added cvars about the SQL settings, suggested by @Arkshine.
- All admins will be logged into the SQL.
- All messages are changed to server_print.
- Added prefix for the messages.

1.1 - Fix code.
1.0 - Code changes again, and again thanks to @Nextra.
0.2 - Code changes. Thanks to @Nextra.
0.1 - First release.


Attached Files
File Type: sma Get Plugin or Get Source (SqlLogAdminConnect.sma - 1610 views - 5.1 KB)
File Type: zip sql_log_admin.zip (694 Bytes, 602 views)

Last edited by dark_style; 10-23-2011 at 01:59.
dark_style is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 12-30-2010 , 18:15   Re: SQL Log Admin Connect
Reply With Quote #2

Don't upload .amxx files anywhere. You are not allowed to do that.

Design Suggestions:
- I'd recommend to also store the admin's SteamId. Without that information any other information is basically useless.

Code suggestions:
- Some code in your SQL Handler looks like debug code. At least the output does not make sense otherwise. Either put appropriate functionality there or remove the debug code (on a side node, the format in server_print is not valid).
- Printing the PLUGIN name in every message is a bad idea. You should only print a plugin tag or a shorthand of the plugin name. Printing 26 chars in front of a log message just doesn't look good.
- For things like your mysql_init AMXX features the plugin_cfg forward. You should probably use that.
- Use formatex where applicable.
- Check for the admin flag first. Right now you are initializing a bunch of arrays and getting data which will go unused most of the time.
- Why do you make the database have varchar(100) fields when the name can only be 32 chars long on insert. This is not necessary.
- You have to escape the username and hostname if you don't want to run into trouble.
- At least one of your date and time arrays is too small.
- The Error variable should be local to mysql_init. It is not needed anywhere else and it is bad style to have two variables named the same (even if it works out, given how the compiler prioritizes them).
- Instead the query variable could be global or static.
- You are mixing console_print(0, ... ) and server_print. Be consistent.
__________________
In Flames we trust!
Nextra is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-30-2010 , 23:34   Re: SQL Log Admin Connect
Reply With Quote #3

You are not allowed to post .amxx files.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 12-31-2010 , 01:01   Re: SQL Log Admin Connect
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
You are not allowed to post .amxx files.
I'm sorry. Now the archive includes only .php file.
New Version!

Last edited by dark_style; 12-31-2010 at 07:19.
dark_style is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 12-31-2010 , 08:46   Re: SQL Log Admin Connect
Reply With Quote #5

PHP Code:
if(is_user_connected(id) & get_user_flags(id) & read_flags(AdminFlag)) 
The first '&' should be '&&'. Also continue to work on it and read through my list for further advice.
__________________
In Flames we trust!
Nextra is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 12-31-2010 , 08:50   Re: SQL Log Admin Connect
Reply With Quote #6

Quote:
Originally Posted by Nextra View Post
PHP Code:
if(is_user_connected(id) & get_user_flags(id) & read_flags(AdminFlag)) 
The first '&' should be '&&'. Also continue to work on it and read through my list for further advice.
Changed, thanks. I read your first post and done some things, but that for varchar I can't, becouse there's prefix which has chars.

Last edited by dark_style; 12-31-2010 at 11:14.
dark_style is offline
s3rserii
Senior Member
Join Date: Jan 2010
Old 12-31-2010 , 16:25   Re: SQL Log Admin Connect
Reply With Quote #7

Quote:
Originally Posted by dark_style View Post
SQL Log Admin Connect
Authors: Dark_Style & Kostov
Version: 0.2
Description:
When admin join in the server he will be included in SQL. Server, date/time, and his name will be logged. You can change which flags admins can be included. The archive included .php file.


Modules:
PHP Code:
#include <sqlx> 


Source Edit:

PHP Code:
#define AdminFlag "abcd" 

/*=== Sql Settings ====*/ 
#define SqlHost  "127.0.0.1" 
#define SqlUser  "root"  
#define SqlPass  "" 
#define SqlDb    "sqlamxx" 
#define SqlTable "amx_connect_admin" 
Changelog:
Code:
0.2 - Code changes. Thanks to @Nextra.
0.1 - First release.


it shows that the plugin is connectetd to the database but when i join the server it not creat the tables or the informations in the database?

i use amxbans to set my admins, not the normal "users.ini"
s3rserii is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 12-31-2010 , 20:52   Re: SQL Log Admin Connect
Reply With Quote #8

Quote:
Originally Posted by dark_style View Post
Changed, thanks. I read your first post and done some things, but that for varchar I can't, becouse there's prefix which has chars.
I know you have done some things but barely half of it. That's why I said you should continue to work on it. Especially on some crucial things like string escaping which can make your plugin fail totally (for example if the hostname has unescaped characters your plugin will not work at all).

And you can change the varchar size. You have
PHP Code:
HostName[64], AdminName[32
but reserve 100 for both.
__________________
In Flames we trust!
Nextra is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 01-01-2011 , 02:45   Re: SQL Log Admin Connect
Reply With Quote #9

Quote:
Originally Posted by Nextra View Post
I know you have done some things but barely half of it. That's why I said you should continue to work on it. Especially on some crucial things like string escaping which can make your plugin fail totally (for example if the hostname has unescaped characters your plugin will not work at all).

And you can change the varchar size. You have
PHP Code:
HostName[64], AdminName[32
but reserve 100 for both.
Thanks for your support! Working on new version. When it's done, I'll upload it. Happy New Year! Have fun on the holiday!

Last edited by dark_style; 01-01-2011 at 02:52.
dark_style is offline
s3rserii
Senior Member
Join Date: Jan 2010
Old 01-01-2011 , 08:36   Re: SQL Log Admin Connect
Reply With Quote #10

Quote:
Originally Posted by s3rserii View Post
it shows that the plugin is connectetd to the database but when i join the server it not creat the tables or the informations in the database?

i use amxbans to set my admins, not the normal "users.ini"
for now its not work or what?
s3rserii 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 02:29.


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