Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Gaming
Minecraft
Minecraft Tutorials
Remotely send commands to a server [1.3.1][PHP]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Macemore" data-source="post: 131696" data-attributes="member: 6113"><p>Before we start you need:</p><p>1) To be owner of the server, or access to the files.</p><p>2) How to copy 'n paste</p><p>3) use common sense</p><p>4) Have Craftbukkit 1.3.1</p><p>5) using Xampp, or some kind of webserver</p><p> </p><p>Alright here we go!</p><p>First off, make sure you're running <a href="http://dl.bukkit.org" target="_blank">CraftBukkit 1.3.1 </a>if you're not, GO GET IT!</p><p>Install PHPSend plugin by downloading the files <a href="http://dev.bukkit.org/server-mods/phpsend/files/2-phpsend-0-9/" target="_blank">HERE</a> and copy the files to the plugins folder where your server is located.</p><p> </p><p>Next open up xampp, or what ever webserver/webhost you use and copy these files into it:</p><p><strong>PHPSend.php</strong></p><p>[PHP]<?php</p><p> </p><p>error_reporting(0);</p><p> </p><p>class PHPresponse</p><p>{</p><p>var $msg;</p><p>var $from;</p><p> </p><p>function isFrom($who)</p><p>{</p><p>if ($who==$from)</p><p>return true;</p><p>else</p><p>return false;</p><p>}</p><p>}</p><p> </p><p>function recv($socket)</p><p>{</p><p>$r=socket_read($socket, 256, PHP_NORMAL_READ);</p><p>return substr($r,0,-1);</p><p>}</p><p> </p><p>class PHPsend</p><p>{</p><p>var $socket=null;</p><p> </p><p>function PHPconnect($adress, $password, $port=11223)</p><p>{</p><p>$this->socket = socket_create(AF_INET, SOCK_STREAM, 0);</p><p> </p><p>socket_set_block($this->socket);</p><p> </p><p>$result = socket_connect($this->socket, $adress, $port);</p><p> </p><p>if ($this->socket==null)</p><p>return 1;</p><p> </p><p>socket_write($this->socket, md5($password)."\n", strlen(md5($password))+2); //auth</p><p>$result=recv($this->socket);</p><p> </p><p>/*echo 'RESULT: '.$result."\n";</p><p>echo md5($result)."\n";*/</p><p> </p><p>if ($result!="PHPpass0")</p><p>return 2;</p><p>else</p><p>return 0;</p><p>}</p><p> </p><p>function PHPcommand($command)</p><p>{</p><p>socket_write($this->socket, $command."\n",strlen($command)+2);</p><p>$result=recv($this->socket);</p><p> </p><p>if ($result!="PHPcmd0")</p><p>return 1;</p><p>return 0;</p><p>}</p><p> </p><p>function PHPdisconnect()</p><p>{</p><p>socket_write($this->socket, "PHPdisconnect\n",15);</p><p>$result=recv($this->socket);</p><p> </p><p>if ($result!="PHPdisconnect0")</p><p>return 1;</p><p>return 0;</p><p>}</p><p> </p><p>function PHPrecv()</p><p>{</p><p>$result=recv($this->socket);</p><p>$resp=explode(':',$result,2);</p><p>$r=new PHPresponse();</p><p>$r->from=$resp[0];</p><p>$r->msg=$resp[1];</p><p>return $r;</p><p>}</p><p> </p><p>function PHPrecvMsg()</p><p>{</p><p>$result=recv($this->socket);</p><p>$resp=explode(':',$result,2);</p><p>return $resp[1];</p><p>}</p><p>}</p><p> </p><p>?></p><p>[/PHP]</p><p> </p><p><strong>sendphp.php</strong></p><p>[PHP]</p><p> </p><p><?php</p><p> </p><p># Configuration #</p><p>$connect['server'] = '127.0.0.1'; # Server's IP address #</p><p>$connect['password'] = '3fc3168e44e3ef90'; # PHPSend's Password #</p><p>$connect['port'] = '11223'; # The port PHPSend opperates on #</p><p># Do NOT touch anything below this line, please #</p><p>$command = $_POST['command'];</p><p> </p><p>include('PHPsend.php'); # Include the API #</p><p> </p><p>$con = new PHPsend();</p><p>$succ = $con->PHPconnect($connect['server'],$connect['password'],$connect['port']);</p><p>if($succ == '0') {</p><p> $con->PHPcommand($command);</p><p> echo 'Command successfully executed';</p><p>} elseif($succ == '1') {</p><p> echo 'Could not connect to server, are your details correct?';</p><p>} elseif($succ == '2') {</p><p> echo 'incorrect password, please check your password and try again';</p><p>} else {</p><p> echo 'an unexpected error occured (Error code: 1)';</p><p>}</p><p>?></p><p>[/PHP]</p><p><strong>Index.php</strong></p><p>[PHP]</p><p><html></p><p> <head></p><p> <title>PHPSend Command</title></p><p> </head></p><p> <body></p><p> <form name='send' action='sendphp.php' method ='post'"'></p><p> <form name="input" action="html_form_action.asp" method="get"></p><p> Command: <input type="text" name="command" /></p><p> <input type="submit" value="Send" /></p><p> </form></p><p> </body></p><p></html></p><p>[/PHP]</p><p>OR Download here: <a href="http://sharefa.st/view/iiCmLrWPu1Qz" target="_blank">http://sharefa.st/view/iiCmLrWPu1Qz</a></p><p>Once you have all three of those files, go to <strong>sendphp.php</strong> and change the configuration on lines 4-6 to your server details. then load up index.php and enjoy <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p><p>Credits:</p><p>90% me</p><p>10% <a href="http://dev.bukkit.org/profiles/kittyPL/" target="_blank">kittyPL</a> - PHPSend.php and PHPSend plugin <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p><p>Please don't release this anywhere else without my permission, if you need any assistance feel free to PM me, but please DON'T post it the thread. It's annoying.</p><p>Enjoy.</p></blockquote><p></p>
[QUOTE="Macemore, post: 131696, member: 6113"] Before we start you need: 1) To be owner of the server, or access to the files. 2) How to copy 'n paste 3) use common sense 4) Have Craftbukkit 1.3.1 5) using Xampp, or some kind of webserver Alright here we go! First off, make sure you're running [URL='http://dl.bukkit.org']CraftBukkit 1.3.1 [/URL]if you're not, GO GET IT! Install PHPSend plugin by downloading the files [URL='http://dev.bukkit.org/server-mods/phpsend/files/2-phpsend-0-9/']HERE[/URL] and copy the files to the plugins folder where your server is located. Next open up xampp, or what ever webserver/webhost you use and copy these files into it: [B]PHPSend.php[/B] [PHP]<?php error_reporting(0); class PHPresponse { var $msg; var $from; function isFrom($who) { if ($who==$from) return true; else return false; } } function recv($socket) { $r=socket_read($socket, 256, PHP_NORMAL_READ); return substr($r,0,-1); } class PHPsend { var $socket=null; function PHPconnect($adress, $password, $port=11223) { $this->socket = socket_create(AF_INET, SOCK_STREAM, 0); socket_set_block($this->socket); $result = socket_connect($this->socket, $adress, $port); if ($this->socket==null) return 1; socket_write($this->socket, md5($password)."\n", strlen(md5($password))+2); //auth $result=recv($this->socket); /*echo 'RESULT: '.$result."\n"; echo md5($result)."\n";*/ if ($result!="PHPpass0") return 2; else return 0; } function PHPcommand($command) { socket_write($this->socket, $command."\n",strlen($command)+2); $result=recv($this->socket); if ($result!="PHPcmd0") return 1; return 0; } function PHPdisconnect() { socket_write($this->socket, "PHPdisconnect\n",15); $result=recv($this->socket); if ($result!="PHPdisconnect0") return 1; return 0; } function PHPrecv() { $result=recv($this->socket); $resp=explode(':',$result,2); $r=new PHPresponse(); $r->from=$resp[0]; $r->msg=$resp[1]; return $r; } function PHPrecvMsg() { $result=recv($this->socket); $resp=explode(':',$result,2); return $resp[1]; } } ?> [/PHP] [B]sendphp.php[/B] [PHP] <?php # Configuration # $connect['server'] = '127.0.0.1'; # Server's IP address # $connect['password'] = '3fc3168e44e3ef90'; # PHPSend's Password # $connect['port'] = '11223'; # The port PHPSend opperates on # # Do NOT touch anything below this line, please # $command = $_POST['command']; include('PHPsend.php'); # Include the API # $con = new PHPsend(); $succ = $con->PHPconnect($connect['server'],$connect['password'],$connect['port']); if($succ == '0') { $con->PHPcommand($command); echo 'Command successfully executed'; } elseif($succ == '1') { echo 'Could not connect to server, are your details correct?'; } elseif($succ == '2') { echo 'incorrect password, please check your password and try again'; } else { echo 'an unexpected error occured (Error code: 1)'; } ?> [/PHP] [B]Index.php[/B] [PHP] <html> <head> <title>PHPSend Command</title> </head> <body> <form name='send' action='sendphp.php' method ='post'"'> <form name="input" action="html_form_action.asp" method="get"> Command: <input type="text" name="command" /> <input type="submit" value="Send" /> </form> </body> </html> [/PHP] OR Download here: [URL]http://sharefa.st/view/iiCmLrWPu1Qz[/URL] Once you have all three of those files, go to [B]sendphp.php[/B] and change the configuration on lines 4-6 to your server details. then load up index.php and enjoy :) Credits: 90% me 10% [URL='http://dev.bukkit.org/profiles/kittyPL/']kittyPL[/URL] - PHPSend.php and PHPSend plugin :) Please don't release this anywhere else without my permission, if you need any assistance feel free to PM me, but please DON'T post it the thread. It's annoying. Enjoy. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Gaming
Minecraft
Minecraft Tutorials
Remotely send commands to a server [1.3.1][PHP]
Top