PHPsend
PHPsend
Execute console commands using PHP scripts on website!
This plugin provides simple API and lightweight plugin to allow you command your server from your webpage!
To all updating people. You will have to update your scripts plugins, the main thing is that now functions are prefixed with PHPS instead of PHP (for example old PHPconnect is now PHPSconnect).
PHPsend is now PHPSend**
NEW VERSION
- Logging level (No more console spam!), new logging system
- Hash algorithm is now SHA1
- Player associated commands
- New command: phpsend reload to let you reload config and whitelist without server restart
- IP Whitelist for both php script and plugin
- Post argument style
- Protocol names are now with PHPS instead of PHP (like PHPconnect is now PHPSconnect)
- New plugin hook: onWebCommandAsPlayer
- Cleaned up code
- Minor bugs fixed, more exceptions handled.
- Add few API functions to make your life even simplier.
Pages are updated now. Just wait for approval.
Features:
- Execute commands from web
- Using SHA1 password to authenticate
- Simple API with few fuctions!
- Configurable port (default: 11223)
- EXTREME small
- Support for /reload!!!
Plugin API Tutorial - Making simple online player website
Dev Builds
Development builds of this project can be acquired at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk.
@kittyPL
Thanks :D I created the folder and file but when I type the command "/plugins" PHPsend does not appear ... :/ But what should you put in the configuration? What "Post_password"? And the port, I have to leave it there or put another? Thank you in advance!
@GrandVipercool
Hmm. It should work ok. You can create config manually, also check if PHPsend enables without errors. If you have java6, download Java 1.6 PHPsend version (link above). Anyway, you can have the config here:
Just change what you want. Filename is config.yml in folder plugins/PHPsend.
Hope this helps!
Hi all, I have a small problem when restart after put the plugin in the "plugins", no folder / config file is created. Am I the only one? How to solve the problem?
Thank you in advance!
@The_Guardian
Of course, I will add this in config. Gonna work a bit more tomorrow, Im was busy last week.
I just have one suggestion now that I got this working, I'm working on a system that will be constantly sending data back and forth. The console gets spammed with PHPsend output. Maybe a config to disable this would be awesome.
@KoolSource
My code is not obfuscated, you can easily decompile it with any java decompiler.
Just download this: http:java.decompiler.free.fr/?q=jdgui and decompile :)
Sorry that I didn't provide archive with source, I'm busy this week :C
@kittyPL
If you look at my example in the pastebin I assigned $args to $_POST['args'] (assuming that you could also send the Username, and possibly other information about the user as well)
I could have just used $_POST['args']['ArgNumber'] as well, or $_POST['ArgNumber'] if you chose to not include extra information about the user. I generally don't use $_POST directly and assign the items within the array to different variables ($args = $_POST['args'], $user = $_POST['user'], etc) It's just an old habit.
Would I be able to get the 0.9 source?
-John
@KoolSource
Source is outdated. It's 0.7 src while actual version is 0.9 ;)
Anyway, packing array into string just to use is slightly different? :/ Why do you need it in $args, when you can have it in _$POST?
@kittyPL
I don't mind helping with the changes, but I don't see where in your source that any commands are being parsed at all... seems to only show the PHP -> Bukkit source although I might just be missing it; I only took a quick look.
With my example you don't necessarily need to use array_shifts; you could just use $args['argnumber'] and get it that way. I used array_shift because it removes and returns the 0 value of the array making it easier to get the reason from the rest of the array using implode :)
-John
@KoolSource
I will check what can I do, maybe /website2 <arg> <arg2>.
But I think that key-val is easier... You can use
$_POST['key']
And don't have to care about how many shifts you have done :)
Also look my post 4 messages bellow (#18), Im changing syntax next version.
Anyway I dont have time now... You would have to wait even if I decided to make changes you suggest sorry :C
Hello
On closer look your plugin seems to be better than WebSend in general although there is one thing I'd like to see changed if possible:
/website <key1> <val1> <key2> <val2> ...
to
/website <arg1> <arg2> <arg3> <arg4> ...
It's not that difficult to parse the arguments to key and value pairs on the PHP end of things, and not everyone might want to use it in this fashion. For example maybe you want to have a command followed by a message. You could easily do this if the arguments were put into an array: http://pastebin.com/U28UfcMV
Maybe some type of toggle to choose which you want would be best..
-John
@Uzalu
Maybe I changed something before testing... Im sure that non-numeric values should work... Anyway, Im really busy now. I can provide beta for you when I solved this, but it may contain bugs (due to not finished bukkit->bukkit2). Just tell me if you want
@kittyPL
how can it work fine for you if all i'm doing is printing out what the command sends? What's the alternative here, could it be that the bukkit configuration affects this command in some way, and that i happen to have a peculiar or different config from most people? I doubt it.
Also, you didn't address my connection problems.
I'm going to try this on a fresh bukkit. Will report back if i get the same problems.
@Uzalu
Nah, It worked fine for me. I decided to change command syntax, in 1.0 you will have to write:
for example:
Expect 1.0 tomorrow :) I gonna add bukkit -> bukkit2 communication :)
@kittyPL
no, it happens with string values too.
/website testa a testb b
[auth] => <auth>
[testa] => a
[a] => testb
@Uzalu
Okay. This happens when you have number values. I don't know why, I will try to fix it now.
@kittyPL
Thanks for replying, and it wasn't too late :D
i know that not giving auth sends what is in the config, and it is correct. I can connect.
Will try print_r now, but i know for certain that some incorrect values were passed, since comparing for 'ping' when i sent it in the command resulted in nothing being returned.
Yes, there is still the same problem with the command, here's what i did:
/website test1 1 test2 2
[auth] => <correct auth from file>
[test1] => 1
[1] => test2
This does at least mean that i can use just one key and it will be accurate, but i know there will be times when i want to use more than that, and your command is supposed to support it.
To solve the command problem, posting my code makes no difference. I have tried deleting all code in the file except for the $_POST output, but it gives the same thing. It seems to me like you need to shift what is read each time forward once more, as it takes '1' to be the key for the value 'test2'.
However, for the connection problems, posting my code may well help.
http://pastebin.com/CTEQjzKR
@Uzalu
I just checked everything and it works for me. Pos your php code so I can help you better.
Even giving auth works! Check your $_POST with
print_r($_POST);
Then you can be 100% sure what is in $_POST. As I said, post your code and I will try to help you.
Sorry for answering late :C
@Uzalu
You don't need to pass auth, it's passed automaticly. I will chcek it in a minute. Try without auth <pasword>. Also notice that PHPsend server password and default auth value isn't same thing. Look at config, field postPassword is auto-passed in auth.