View Single Post
nineteeneleven
Veteran Member
Join Date: Nov 2010
Old 04-04-2014 , 20:52   Re: Donation Control 2.0.4 [updated 11-9-13]
Reply With Quote #216

Quote:
Originally Posted by samsah View Post
Can you make it change players nick which includes symbol ' or /
It will screw up admins.cfg
Example of name: Player/can't run
Code:
"Admins"
{
    "Player"
    {
        "can't run"
        {
            "auth"        "steam"
            "identity"        "STEAM_0:0:123456789"
            "group"        "VIP"
        }
    }
}
Not a big deal but it spams error after every adminreload:
[admin-flatfile.smx] Error(s) detected parsing addons/sourcemod/configs/admins.cfg
[admin-flatfile.smx] (line x) Failed to create admin: did you forget either the auth or identity properties?

Funny though, when adding/editing user in Sourcebans it allows / but not '


heres a quick fix
add this on line 145 of includes/class_lib.php


PHP Code:
$steam_id str_replace(array("/","'" ), ""$steam_id); 

the whole method should look like this.
PHP Code:
   public function addDonor($steam_id$username$tier){
//check sourcebans database to see if user is already in there
    
$group $this->getGroup($tier);
    
$steam_id str_replace(array("/","'" ), ""$steam_id);
    
$sb_pw "1fcc1a43dfb4a474abb925f54e65f426e932b59e";

    
$result$this->db->query("SELECT * FROM ".SB_PREFIX."_admins WHERE authid='".$steam_id."';") or die($this->db->error " " $this->db->errno);

        if(
$result){
            
$row=$result->fetch_array(MYSQLI_ASSOC);
            
$sb_aid $row['aid'];
        } 

    if (isset(
$sb_aid)) {
        return (
"user is already in the Sourcebans database.<br /> Aborting. <br /> <a href='javascript:history.go(-1);'>Click here to go back</a>");
    } else {
        
//if not, PUT EM IN!

                
$sb_sql "INSERT INTO `".SOURCEBANS_DB."` . `".SB_PREFIX."_admins` (user,authid,password,gid,extraflags,immunity,srv_group) VALUES ('{$username}', '{$steam_id}', '{$sb_pw}' , '-1' , '0' , '0', '".$group['name']."');";
                
$this->db->query($sb_sql) or die($this->db->error " " $this->db->errno);
                
                
$admin_id $this->db->insert_id;
                
                
$sb_sql2 "INSERT INTO `".SOURCEBANS_DB."` . `".SB_PREFIX."_admins_servers_groups` (admin_id,group_id,srv_group_id,server_id) VALUES('{$admin_id}', '".$group['group_id']."', '".$group['srv_group_id']."', '".$group['server_id']."');"
                
$this->db->query($sb_sql2) or die($this->db->error " " $this->db->errno);
                
                
// if (!$this->queryServers('sm_reloadadmins')) { 
                //     return "<h1>Server rehash failed</h1>";
                // }
        
}

        return 
TRUE;

    } 
__________________
nineteeneleven is offline