Welcome to Pawncraft!

Want to become a part of our growing community? Sign up Today!

Sign Up
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. we are running version 1.12
    | Join us at IP: pawncraft.co.uk |
    Dismiss Notice
  3. There is trouble with our mail service and we are looking into it. For a backup solution mail will come from pawncraft@pfts.se and no-reply@pfts.se //StarScore
    Dismiss Notice

Calling all Tech Heads (PHP Coders)

Discussion in 'Banter' started by MrHobbits, 24 Jan 2012.

  1. MrHobbits

    MrHobbits The Angry Panda Staff Member

    Joined:
    24 Sep 2010
    Posts:
    1,970
    Likes Received:
    209
    So here's the deal, I want to put Votifier on my website.

    I've talked to a plugin developer for the scripting system I use and he's pretty much at a loss. He doesnt understand exactly how it all works.

    I've got a piece of demo code that you can thunk your heads on and see if you can figure it out.

    If you can use this code as a springpad to get a SIMPLE PHP enabled website together, consisting of a landing page where they enter in their MC username, and a 'submit' button to make it send that data over to the pawncraft listener.

    If we can develop this simple page, that would be awesome. There also might be a small financial kickback if that helps interest you. :)

    Code samples:
    Code:
    <?php
     
    error_reporting(E_ALL);
     
    // Details of the vote.
    $str = "VOTE\n" .
          "mcserverstatus\n" .
          "ryanshawty\n" .
          "203.0.113.1\n" .
          time()."\n";
     
    // Fill in empty space to make the encrypted block 256 bytes.
    $leftover = (256 - strlen($str)) / 2;
     
    while ($leftover > 0) {
        $str .= "\x0";
        $leftover--;
    }
     
    // The public key, this is an example.
    $key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsbqjZCrHLKC5EyJQixqUjOQmjnLyKcfOduP3mgk4jRUnnZNkmFyHelMrGVl0gaBuIckOdHQvQi1zFckvQ2X4OOfhVreIdh7HuYmPvxXUFUytnIaUEtS37BKA3WFmPNhRsflPgX9Ci/z32rLZrl8Cf9s19JFYM0ffTaz0sGGqK7mDp2ImsPnsbnyBRCT3hhF00VupKJFWeN3FXLBSzh9CK2Rdh3ibZAsS+wmCGOi4S+iWNKKY2hHD/Ap7oFAiBW9jkY+McmZmvJnhjl6P551gYR076ClHMsW9fmxujaCmTkAP2TwzuZmsfgtmO1CQsouxhDvxbsozUxeHXl9ACQbIuwIDAQAB";
    $key = wordwrap($key, 65, "\n", true);
    $key = <<<EOF
    -----BEGIN PUBLIC KEY-----
    $key
    -----END PUBLIC KEY-----
    EOF;
     
    // Encrypt the string.
    openssl_public_encrypt($str, $encrypted, $key);
     
    // Establish a connection to Votifier.
    $socket = fsockopen("188.138.109.87", "8192", $errno, $errstr, 2);
     
    if (!$socket) {
        die("Failed to connect to Votifier.");
    }
     
    // Send the contents of the encrypted block to Votifier.
    fwrite($socket, $encrypted);
     
    #1
  2. MrHobbits

    MrHobbits The Angry Panda Staff Member

    Joined:
    24 Sep 2010
    Posts:
    1,970
    Likes Received:
    209
    Sigh... bump for wishfulness?
     
    #2
  3. the_amber_trap

    the_amber_trap Calm down so I can be the angry one. Staff Member

    Joined:
    23 Nov 2010
    Posts:
    8,660
    Likes Received:
    606
    I'm not smart in this area, sorry. I really wish I could help.
     
    #3

Share This Page