Inactive [ADMN/WEB/DEV]PHPsend v0.9 - Execute console commands with PHP in 4 lines of code!!! [1.3.1-R1.0]

Discussion in 'Inactive/Unsupported Plugins' started by kittyPL, Aug 8, 2012.

  1. Offline

    md_5

    Approved.
     
  2. Offline

    kittyPL

    md_5 Thanks!

    pigplushy Im very glad to hear it :) If you have any ideas what to add to next version, post it here. I will do my best to satisfy you and other PHPsend users.
     
  3. This Plugin is WAY better, than Websend (sorry Waterflames).
    :)
     
  4. Offline

    kittyPL

    Last edited by a moderator: May 27, 2016
  5. Offline

    File

    Can someone post me the .php file to make donation system , i simpy cant figure out the php specially the addres of the server and all that ...pleas help.
     
  6. Offline

    kittyPL

    File

    It's quite simple :) You should put PHPsend.jar to plugins folder as usualy. Then reload/restart server, and PHPsend will generate config. Go to Plugins/PHPsend/config.yml and copy password field. It should be something like "3faf39c393fe4ff0". Then you should write your PHP script. It should look like this (in pseudo-code):

    PHP:
    if (User_donated())
    {
        
    connect_to_Bukkit();
        
    move_user_to_donor_group(); //or anything you get for donation.
        
    disconnect();
        echo 
    'Donated succesfully!';
    }
    else
    {
        echo 
    'You haven't donated!';
    }
    I wont help you in User_donated(), it depends on how do people donate to your server.

    but this part:


    PHP:
        connect_to_Bukkit();
        
    move_user_to_donor_group(); //or anything you get for donation.
        
    disconnect();
    is:

    PHP:
        $con = new PHPsend();
        
    $con->PHPconnect("Your IP here","Your password");
        
    $con->PHPcommand("setrank "+$user+" donor"); //or any other command you want to execute on server
        
    $con->PHPdisconnect();
    And that's all!

    If you need help or get any error, post it here or PM me! :) I will help as much as I can.
     
  7. Offline

    pigplushy

    PHP:
    <?php
     
        
    //Log Errors
        
    ini_set('log_errors'true);
        
    ini_set('error_log'dirname(__FILE__).'/ipn_errors.log');
       
        include(
    'ipnlistener.php');
        
    $listener = new IpnListener(); //start a new ipn listener   
        
    $listener->use_sandbox true//set to false if your going live
        //Now we're going to try and catch the paypal response
        
    try {
            
    $listener->requirePostMethod();
            
    $verified $listener->processIpn();
        } catch (
    Exception $e) {
            
    error_log($e->getMessage());
            exit(
    0);
        }
       
        if (
    $verified) {
            
    //You would implement additional fraud checks and MySQL storage
            //but this is an example so we're going to run it
            
    $con = new PHPsend();
            
    $con->PHPconnect("Your IP here","Your password");
            
    $con->PHPcommand("setrank "+$user+" donor"); //or any other command you want to execute on server
            
    $con->PHPdisconnect();
        } else {
            
    // manually investigate the invalid IPN
            
    mail('YOUR EMAIL ADDRESS''Invalid IPN'$listener->getTextReport());
        }
    ?>
    This is an extremely rough script that you'd save as IPN.PHP

    And here is The IPN Listener
    https://github.com/Quixotix/PHP-PayPal-IPN/blob/master/ipnlistener.php
     
    kittyPL likes this.
  8. Offline

    kittyPL

    pigplushy likes this.
  9. Offline

    pigplushy

  10. Offline

    tanveergt5

    great work gona try this out!
     
  11. Offline

    kittyPL

    Thank you! :D Im also working on bukkit->bukkit2 connection. Im quite busy now, but I will try to fix any bugs and release 1.0 asap...
     
  12. Offline

    kittyPL

    Sorry for no updates, Im very busy for few next days...

    Anyway I do my best to answer any PM's, forum thread replies and bukkit dev comments.
    I will have more time on Friday (80% chance), and then I gonna finish and release 1.0! :)
     
  13. Offline

    necrohhh

    Would anyone know how I could allow it to give items to a player even if they are offline?

    Thanks for any tips/solutions =]
    - Necro
     
  14. Offline

    kittyPL

    Uhm, I think its quite impossible without external plugin :D Shearch on bukkit forums/ bukkit dev. PHPsend can execute ANY plugin command, so you can use any other plugin :)
     
  15. Offline

    File

    Can someone help in this ive done evrything correctly but when i run the page then nothing happens .... even thou in the server says [PHPsend] Enabling PHPsend v0.9
    21:28:31 [INFO] [PHPsend] Config loaded.
    21:28:31 [INFO] [PHPsend] PHPsend started main thread.
    21:28:31 [INFO] [PHPsend] Started hosting.

    Can you help me step by step pleas to make like an donation system i really cant figure out the ip part either like should it be public ip or internal ip ? can some one make a custom script for me pleas ... i have mamp and all that setup but still doesnt work ... ive been shitting around with this like 2 months :/

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

    kittyPL

    File
    So basicaly, you need PHPsend plugin enabled on your server, and PHP script on your website. When user donates, he is redirected to a website where PHPsend API script is executed, and then the right command is sent to the bukkit server. The PHP script should:

    -Check if user has donated
    -Connect to bukkit server
    -Execute command
    -Disconnect from server
    -Inform user about results

    About connecting:
    You have to specify the IP adress of the BUKKIT machine (same as IP that user puts in to connect). Port is 11223, if you havent changed it in config. Password, you have to check it in plugins/PHPsend/config.yml file (It's password field). Password is random-generated. Then you can execute commands, using $PHPsendInstance->PHPcommand("say hello"). Remember to disconnect (even if you don't, PHPsend should give apropiate message). I cant help you with donation checks, unless you wont give more info (at least how would you like you users to donate). If you want paypal, check awesome pigplushy's paypal donation example few points above!

    If you have more problems post them, but give some more data :D


    I think thats all I can help, unless you have concrete question.
     
  17. Offline

    File

    Okey.I have evrything setup im using fortumo for payments.The problem is i don't understand the php and all that for the website im using mamp you know where the script should go.The command for setting people into certain group is "/pex user file group set vip" For the ip i have to ip's the one that i have in server.properties and the other that people uses to get inside my server.If you would be so kind and would make me a custom script.I also have the port forwarded but should it be "tcp" "udp" or "both" .
     
  18. Offline

    kittyPL

    Learn PHP, without it you can't use PHPsend and even best developer isn't able to help you (or maybe you have friend that can do this from start to end, and you trust him enough to give him all passwords). I suggest you, to learn basics of PHP, start with this: http://www.tizag.com/phpT/, then read this http://php.net/manual/en/tutorial.php. You should now have some basic knowedgle about PHP. Read about forms in html, about $_POST and $_GET in PHP, also check out any donation system API (should be well described). Probably fortumo has many many examples, as it is a quite big company. Then you need your script, I can post you some parts of mine :)

    In one file, that I won't post, you have form using POST with user and code variables. User is ingame username, code is the code from SMS. It redirects you to vip.php where you have:

    PHP:
    <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
    </head>
     
    <?php
        
    include_once('CodeCheckingLibraryForMyPremiumSmsProvider.php');
        include_once(
    'PHPsend.php'); //the PHPsend API
       
        
    echo 'Checking code, please wait...<br>'//infor user about what's going on... (<br> is newline)
       
        
    if (!isset($_POST['code']) || !isset($_POST['user'])) //If user didn't used form...
        
    {
            echo 
    'Invalid data'//inform him and redirect to error page (ERR 9)
            
    echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://mypage.com/err.php?err=9">';
            exit();
        }
       
        
    $c = new PHPsend();
        
    $succ $c->PHPconnect("myIP","myPassword",myPort);
       
        
    $code=$_POST['code'];
        
    $user=$_POST['user'];
     
        if (
    $succ!=0)
        {
            
    //if connecting to server failed redirect to error page (ERR 2)
            
    echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://mypage.com/err.php?err=2">';
            exit();
        }
       
        
    $cc = new CodeCheckWrapper(); //SMS code checking
        
    $r=$cc->dummyValidate("Somedata","SMSnumber",$code);
       
        if (
    $r)
        {
            
    //if code is ok, command server to setrank user vip, or any other command
            
    $c->PHPcommand("setrank ".$user." vip;");
            
    $c->PHPdisconnect(); //disconnect
            
    echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://mypage.com/OK.php">'//redirect to ok.php
        
    }
        else
        {
            
    //if code is wrong, redirect to error page (ERR 1)
            
    echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://mypage.com/err.php?err=1">';
            
    $c->PHPdisconnect();
        }
        echo 
    "done";
    ?>
    Okay. You can modify this script and use on own purposes. I also have mySQL logging of all transactions, and anti-flood by IP (just 100ms interval).

    Add this yourself :)

    Hope this helps, kittyPL
     
  19. Offline

    File

    I just need the script that i can run by fortumo :) no need for connecting to fortumo :)
     
  20. Offline

    kittyPL

    You see how my script works? You understand it? If not, do what I said or forget about donatnion system. You need to authenticate the code user inputs somehow...

    Really. Do what I said. It won't take more than 3 days.
     
  21. Offline

    File

    So i will just copy the script ? :) or ??
     
  22. Offline

    kittyPL

    File
    NOPE. I gave you MY OWN script, to let you know how it works for me. LEARN PHP. Its not as easy as copy/paste...
    I said learn PHP. Man, just some work. Don't think ppl do everything for you. Also its better to some things yourself...
     
  23. Offline

    File

    I don't have the time :( I watched some videos but i still don't get anything i know that $ means a value and // means info about what are you doing

    Can you make the script for me :(( ? If you are using fortumo i can give you some money.

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

    slabby

    I have a problem. I get the error on my test php file "Fatal error: Class 'PHPSend' not found in <my directory> then the line its on ?
     
  25. Offline

    kittyPL

    Use bukkit dev, instead of this thread :)

    Anyway, the tutorial here isn't updated anymore, just use PHPSsend, as of the new class name in 1.0 :)
     
  26. Offline

    lol768

    How is this better than RCON?
     
  27. Offline

    kittyPL

    Again, please use bukkit dev.

    Let's say you want to have online item shop, so when user sens SMS or donates via paypal the console command /give player some_item is executed. I don't think giving rcon to normal player is a good idea...
     
  28. I dont think this is better that rcon, as this is not thread safe, and rcon is thread safe ( i tested it whit a plugin that refuses nn thread safe commands), that means that you server could crash at /reload
     
  29. Offline

    Steffion

    kittyPL does this still work? If it does, thank you!!
     
  30. Offline

    Rilekt

    How to do automatic shop for Minecraft for PayPal?!
    Can i have a code?!
     

Share This Page