SHARE
TWEET

Untitled

a guest Oct 15th, 2011 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * Buycraft notification base/example
  5.  *
  6.  * @author Lmc
  7.  * @copyright Buycraft.net (C) 2011
  8.  */
  9.  
  10. /**
  11.  * Your API secret.
  12.  *
  13.  * Used in verificating that the notification is
  14.  * actually coming from Buycraft and not another
  15.  * site due to Buycraft is the only thing other
  16.  * than you who should know your API secret.
  17.  */
  18. define("API_SECRET", "5435a325285d426c815a43b1007997c012232df8");
  19.  
  20. /**
  21.  * Notification processing
  22.  *
  23.  */
  24. if(isset($_POST['json']) && isset($_POST['secret'])) // JSON encoded string and secret passed to us?
  25. {
  26.         if($_POST['secret'] == API_SECRET) // API secret correct?
  27.         {
  28.                 $notificationArray = json_decode($_POST['json']);
  29.                
  30.                 /**
  31.                  * Validation passed!
  32.                  *
  33.                  * In here it is safe to proceed with processing the notification
  34.                  * knowing that it is actually from Buycraft and 100% legit.
  35.                  */
  36.                
  37.                 $username = $notificationArray['username']; // Users minecraft account
  38.                 $packageId = $notificationArray['package']; // Package ID purchased
  39.                 $expireTime = $notificationArray['expire']; // Unix timestamp when the package expires (0 for a non-expiring package)
  40.                 $emailAddress = $notificationArray['email']; // The paypal email address for this user
  41.         }
  42. }
  43.  
  44. ?>
  45.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top