[DEV/WEB] WebSend v2.4 - Use PHP and other web-languages for bukkit! [1.4.7-R1.0]

Discussion in 'Archived: Plugin Releases' started by Waterflames, Jul 21, 2011.

  1. Offline

    Waterflames

    websend-icon-text-smaller.png

    WebSend - Use PHP for Bukkit!:
    Version: v2.3
    BukkitDev: http://dev.bukkit.org/server-mods/websend/
    What does this plugin do?
    A scheme:
    Ingame command -> Your php-enabled server
    -> Your PHP file does stuff and provides output/commands -> Plugin executes commands and prints output.
    Or:
    Webpage command -> bukkit server -> Plugin executes commands and prints output.

    Example scripts are provided in the files.
    !!! IMPORTANT NOTE !!!
    Use the bukkitDev forum for bugs, questions and other stuff. I will no longer respond here!

    A few of the possibilities:
    • Online adminstration screen
    • Online console
    • Membership system (become VIP with a donation)
    • Paypal donation system
    • ...
    Features:
    • Seperate thread (no server lag because of the wait.)
    • Commands (ingame or console emulation)
    • Command to color output send from php.
    • Secure connection (protected with password hash)
    • Permissions support (just "websend")
    • Both ways enabled (PHP -> bukkit | bukkit -> php (-> bukkit))
    Installation: (more detailed instructions can be found on bukkitdev):
    1. Put the plugin in the plugin folder.
    2. Start/reload server to allow the config file to be generated.
    3. Open the example php file and fill in your password.
    4. Upload the example php file to your server.
    5. Open the config file and fill in the settings.
    6. Reload server and test with "/ws timeset".
    7. Go to the bukkitDev page to find instructions to get started.
    Download on bukkitdev.

    Changelog:
    Show Spoiler

    For more changelog, visit the bukkitdev "files" section.
    Version 0.9:
    • Fixes false error reporting
    • A debug feature was added.
    Version 0.8.1:
    • Couple of small bugfixes for 1240
    Version 0.8:
    • Added error report on invalid /Command/
    • Added warning if the first line doesn't contain the password.
    • Added proper disabling code for ServerSocket.
    • Tweaked the variable checking.
    Version 0.7.1:
    • Added extra POST data. (Info)
    Version 0.7:
    • Enabled input from console
    • Implemented a config line to use a custom port.
    Version 0.6:
    • Added extra POST data. (Info)
    Version 0.5:
    • Added the other way (PHP -> bukkit) Port 4445 needs to be forwarded.
    • Improved config file reading
    • Optimized code structure.
    Version 0.4:
    • Added option to use port 4444 opposed to the default
    Version 0.3:
    • Added color feature. (examples in supplied zip.)
    • Added Console command option (Use /Command/ExecuteConsoleCommand)
    Version 0.2
    • Fixed permissions plugin absence error.
    Version 0.1
    • Plugin released
     

    Attached Files:

  2. Offline

    Waterflames

    Should be possible.
    Pseudocode:
    PHP:
    <?php
    $whiteListedUser 
    $_POST['whitelisteduser'];

    doForumWhiteListing();

    //BukkitServer whitelisting. Requires server to be runnning.
    $PORT 4445;
    $HOST "localhost"//the ip of the bukkit server (in this case it's the same machine)

    $sock socket_create(AF_INETSOCK_STREAM0//Creating a TCP socket
    or die("error: could not create socket\n");

    $succ socket_connect($sock$HOST$PORT//Connecting to to server using that socket
    or die("error: could not connect to bukkit server\n");

    $text "/Command/ExecuteConsoleCommand:whitelist '.$whitelisteduser.';"//the text/command we want to send to the server

    socket_write($sock$textstrlen($text) + 1//Writing the text to the socket
    or die("error: failed to write to socket\n");

    ?>
    If your server isn't always on, you could write a buffer to save the users in if the connection fails and the next time the connection works, you can whitelist the others to.
     
  3. Offline

    RoQua

    tnx il try and see if it works!
     
  4. Offline

    ReCreate

    Oh yes. Good good.
     
  5. more Love :)
    I will test the PHP to Java thing ;)
     
  6. Offline

    Jonchun

    OMG... The capabilities of this plugin are endless... If you have essentials installed, you can literally emulate hundreds of other plugins with an external php server handling different requests like this :O

    I'm super hyped to download this (I'll be on my computer in an hour or two) If this does what I want it to... o.o I think this.will be my fvorite plugin of all time :D

    One question, regarding connecting to minecraft from php without input from minecraft first, I see you have a listener ready but what exactly do I do with ph to establish the connection? Any working snippets?

    Oh also, when you do a command in minecraft, does it POST data? Aghhh I know I'll find out at home but this is too exciting.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  7. Offline

    Waterflames

    Updated official version to 0.5.

    Thank you :p

    Code snippits are provided in the installation zip.

    When you do /ws command thing1 thing2 it will POST command, thing1 and thing2 in an array to a php page you provided!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  8. Offline

    Jonchun

    Oh my god it's perfect ^.^

    You're awesome man! Away goes my global shop plugins, in comes custom CMS/minecraft in-game verification, in comes custom features, in comes vote for vote points, WHOOO. The possibilities are limitless :)

    I'll be willing to share some of my features here too so people can see the power of such a plugin ^.^ Thanks so much!
     
  9. Offline

    Waterflames

    And thank you for using and supporting my plugin :)
     
  10. Offline

    Jonchun

    Is there any command for broadcasting messages that you know of?

    Like for the purpose of simplicity, on my website I have a "click me" button. If the user clicks the button, in game, it says NAME has clicked the button!
     
  11. Offline

    Waterflames

    You could do it like this:
    PHP:
    "/Command/ExecuteConsoleCommand:say ".$name." has clicked the button!;"
     
  12. Offline

    Jonchun

    Well I don't want "[SERVER]" in front of it.
     
  13. Offline

    Waterflames

    This may have been the smallest, easiest plugin I ever wrote :)
    SimpleBroadcast
    PHP:
    "/Command/ExecuteConsoleCommand:broadcast ".$name." has clicked the button!;"
    Broadcast can be replaced by simplebroadcast
     
  14. Offline

    Jonchun

    awesome ^.^

    Ok right now, I'm running into a slight problem. I have my website hosted on Server2. I have the minecraft.php file on localhost. Do you think it's possible to repost data from minecraft.php to my php files on Server2? (after you parse args[0] and decide what the command is of course)
     
  15. Offline

    Waterflames

    Isn't that possible from php? I'm thinking:

    Post data arrives on localhost -> parsing on localhost -> php generates a form with all the data and auto POST's it to Server2 (with a little JS maybe).
     
  16. Offline

    Jonchun

    bleh nvm. I decided to move it all onto localhost ^.^ (btw it works great with webserver and minecraft server on same computer)
     
  17. Offline

    Waterflames

    Works too :)

    Also: I'm on vacation until the 20th, so I'm not sure I will be able to answer questions. Feel free to post them though.
     
  18. Offline

    KaleR

    hello
    this is really a great plugin, but can u add "permissions" so that not every user ca run every command?

    for example that your plugin is checking the $args[0] value if the user is allowded to use this command?
     
  19. Offline

    Waterflames

    You can do this in php. The player name is send as $player i think.
     
  20. Offline

    Jonchun

    Well I think he's looking for Permissions support (like send usergroup along with playername) I would love this feature too :3

    Another question: I've been trying to send commands to the minecraft server without any input from the user (the Whitelist.php). I can't figure out why it's not working. I tried your default Whitelister.php with the correct configurations and the only difference being I changed your time day to say Test.

    I'm not getting a response... (yes i have activatelistener or whatever set to true.)


    edit: I tried from 2 different places. I still get the same result... Doesn't work =/
     
  21. Offline

    Waterflames

    I forgot to mention: port 4445 needs to be forwarded.
     
  22. Offline

    Jonchun

    I doubt that's the problem... I'm on a dedicated IP
     
  23. Offline

    [stranger]

    Plugin sources may be shared?
     
  24. Offline

    Jonchun

    Bug Report:
    Well although it's more my fault than yours, maybe you can put in a command/error handler. I'm fairly certain this error comes from your plugin anyways. I haven't found the EXACT source but I can replicate the error fairly easily. (However, it happened to me once or twice and I have no clue why... Like it shouldn't have happened in theory but it did. I didn't change anything, restarted the server 2-3 times, and it fixed itself.)

    Error:
    Code:
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    00:08:46 [WARNING] Error at SQL Query: query does not return ResultSet
    
    This goes over and over and over... Spams the server log like CRAZY and it becomes way too big to even open properly.

    I'm running CB 1000.

    How to get the Error:
    Although it should be obvious from the warning message, all you have to do is make a mistake on your minecraft.php file. e.g. leave an open brace (if clause) or provide no output or basically have a logic error in your php code. If you try to run /ws _____, it will cause the above errors. It spams the server log so badly that I can't do anything except play on the server or go into my VPS control panel and reboot it. (the server still runs. You just can't run any console commands because of the WARNING message spam.)
     
  25. Offline

    Jonchun

    bleh I know you're still on vacation but I'm gonna ask one more time why/how I can get the listener to work. (send data to minecraft server without having a trigger)

    I KNOW all my ports are unblocked and I KNOW I'm establishing a connection. However, after I send the md5 of my password and follow it with command requests, nothing happens...
     
  26. Offline

    Sich

    same for me, I have try a direct telnet connection, I can connect, but nothin happen when I send the password or the command...
     
  27. Offline

    Waterflames

    Not yet.

    @JagCraft
    @Sich
    About the problem in PHP -> minecraft: I will release a debug version so we can see where the problem is.

    Thank you for the neat and clear bug report, which is quite strange... I can't handle all the possible errors, so there is little I can do about that.
     
  28. Offline

    Jonchun

    Well, perhaps you could try to disable at least the empty return query error. It spams up the server log if left unchecked and overnight my serverlog went from a normal size to 25 gigabytes (hitting my diskspace limit)
     
  29. Offline

    Waterflames

    Disabling it doesn't really seem like a good idea. Other people might need it.
    The error must come up for a good reason, right?

    Plugin compatibility tested with bukkit 1060.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  30. Offline

    Jonchun

    Well, it spams it... Maybe have it show up only once? ._. I mean 25 gigabytes of pure text in a couple hours... It SPAMS the warning...

    Also, any updates on the php->minecraft? Have you retested?
     
  31. Offline

    Waterflames

    Everything works perfectly with me, that is what makes it more difficult :)

    If all those things are right, then download this zip and use the included websend.jar
    That should bypass the password check, print more debug messages and print the received line.
     

    Attached Files:

Share This Page