Code Duplication    Length = 12-12 lines in 2 locations

hooks/rcon_ban.php 1 location

@@ 16-27 (lines=12) @@
13
14
    $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
15
    $result_of_query = $db_connection->query($sql);
16
    if ($result_of_query->num_rows == 1) {
17
        $server = $result_of_query->fetch_object();
18
        try
19
        {
20
            $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
21
            $answer = $rcon->banPlayer($rid, $reason, $time);
22
        }
23
        catch (Exception $e)
24
        {
25
            echo $e->getMessage( );
26
        }
27
    }
28
}
29

hooks/rcon_command.php 1 location

@@ 16-27 (lines=12) @@
13
14
        $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
15
        $result_of_query = $db_connection->query($sql);
16
        if ($result_of_query->num_rows == 1) {
17
            $server = $result_of_query->fetch_object();
18
            try
19
            {
20
                $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
21
                $answer = $rcon->command($cmd);
22
            }
23
            catch (Exception $e)
24
            {
25
                echo $e->getMessage( );
26
            }
27
        }
28
    }
29
}
30