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

Send message to all servers


Post New Thread Reply   
 
Thread Tools Display Modes
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-25-2010 , 21:42   Re: Send message to all servers
Reply With Quote #11

Wow! You are my hero man.

Work perfect, except for one thing... at the end of the message appear quotes...

Example:

Code:
8088 is cool"
And if you can (if is something easy/simple, i don't want to take your time), would be very cool if when you send a messages, the options doesn't reset (becouse if you want to send more than one message you have to set the options all the time when you want to send).

Thanks!!
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
8088
Veteran Member
Join Date: Jan 2008
Old 07-25-2010 , 22:20   Re: Send message to all servers
Reply With Quote #12

Glad it works :)

The code below should be able to reproduce your previous settings:
PHP Code:
<?php
//8088's rcon form 0.00000001.1a

//AMXBans's php rcon class is required
require_once('rcon_hl_net.inc');

//create an array with all of the allowed servers
$servers=array(
1=>array ('server 1''ip1:port1''password'),
2=>array ('server 2''ip2:port2''password'),
3=>array ('server 3''ip3:port3''password')
);

//create an array with all of the allowed commands
$commands=array('to admins only'=>'amx_chat''to everyone'=>'say');
?>

<!--create the form-->
<form name="rcon" action="" method="post">
    <label for="command"><strong>message type</strong></label>
    <select id="command" name="command">
        <?php
        
if($_POST['command'])
        {
            
$commands_reversed=array_flip($commands);
            echo 
'<option value="'.$_POST['command'].'">'.$commands_reversed[$_POST['command']].'</option>';
            unset(
$commands_reversed[$_POST['command']]);
            foreach(
$commands_reversed as $command=>$type)
            {
                echo 
'<option value="'.$command.'">'.$type.'</option>';
            }
        }
        else
        {
            foreach(
$commands as $type=>$command)
            {
                echo 
'<option value="'.$command.'">'.$type.'</option>';
            }
        }
        
?>
    </select><br>
    <strong>server</strong>
    <?php
    
foreach($servers as $server)
    {
        if(
$_POST['server'])
        {
            foreach(
$_POST['server'] as $post_server)
            {
                if(
in_array($post_server$server)) echo '<input type="checkbox" name="server[]" value="'.$server[1].'" checked="checked">'.$server[0];
                else echo 
'<input type="checkbox" name="server[]" value="'.$server[1].'">'.$server[0];
            }
        }
        else echo 
'<input type="checkbox" name="server[]" value="'.$server[1].'">'.$server[0];
    }
    
?>
    <br>
    <label for="message"><strong>message</strong></label><input id="message" type="text" name="message">
    <input type="submit" value="send" />
</form>
<!--start handling POST data-->
<?php
if(($_POST['message']) && ($_POST['server']))
{
    
//received a message and at least one server to send it to

    
if(in_array($_POST['command'], $commands))
    {
        
//received a valid command, so let's build the complete rcon command for use
        
$command=$_POST['command'].' '.$_POST['message'];

        foreach(
$_POST['server'] as $post_server)
        {
            foreach(
$servers as $server)
            {
                if(
in_array($post_server$server))
                {
                    
//retrieve the rcon password
                    
$password=$server[2];

                    
//split the ip and port and store them as seperate values
                    
$split_address=explode(':'$post_server);
                    
$ip=$split_address['0'];
                    
$port=$split_address['1'];

                    
//connect to the server
                    
$rcon=new Rcon();
                    
$rcon->Connect($ip$port$password);

                    
//send the command
                    
$response=$rcon->RconCommand($command);
                    
$lines=explode('\n',$response);

                    
//print the result
                    
foreach($lines as $line)
                    {
                        echo 
$line.'<br>';
                    }
                    
$rcon->Disconnect();
                }
            }
        }
    }
}
?>
The double quotes at the end of the messages should be gone.
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-04-2010 , 10:46   Re: Send message to all servers
Reply With Quote #13

Hey man, sry for posting later... i tested this right now and work just PERFECT. Thanks, really, thanks.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
8088
Veteran Member
Join Date: Jan 2008
Old 08-04-2010 , 10:57   Re: Send message to all servers
Reply With Quote #14

You're welcome :)
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-04-2010 , 11:18   Re: Send message to all servers
Reply With Quote #15

Well... i thought, everyone who know the link of the message.php can send message to the server and flood or whatever... so i started to do something like a "simple login", well.. not a login at all, only a password input. I changed some little things in the code (i don't know php, i only understand some things becouse have html and some things are similar like pawn or other coding languages)... so this is what i changed:

PHP Code:
    <label for="password"><strong>Contraseņa: </strong></label><input id="password" type="text" name="password">
    <
label for="message"><strong>Mensaje: </strong></label><input id="message" type="text" name="message">
    <
input type="submit" value="send" /> 
And this:

PHP Code:
if(($_POST['message']) && ($_POST['server']) && ($_POST['password'] == "alucard")) 
Work perfect but... i post here becouse maybe this is insecure and can bypassed very easly, or is the correct method?

Thanks.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
8088
Veteran Member
Join Date: Jan 2008
Old 08-04-2010 , 11:30   Re: Send message to all servers
Reply With Quote #16

It may work, but if I were you I'd make it a custom page for vBulletin (assuming that it is being used for your Next-Version community). That way you can easily assign and exclude usergroups and, since you won't have to enter a password every time, using it will be more comfortable.
__________________
steamID converter with OpenSearch browser plugin
8088 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 16:44.


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