Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Custom username field set in Plimus
- */
- $username_field = "In-Game_Name";
- /**
- * Email to send error messages too
- */
- $error_email = "deadlypkerzstaff@hotmail.com";
- /**
- * Contracts mappped to the item id they should give
- */
- $items = array("3025978" => "2460");
- /**
- * ipv4 address's of each plimus server
- */
- $plimus_ips = array("62.219.121.253", "209.128.93.248", "72.20.107.242",
- "209.128.93.229", "209.128.93.98", "209.128.93.230", "209.128.93.245",
- "209.128.93.104", "209.128.93.105", "209.128.93.107", "209.128.93.108",
- "209.128.93.242", "209.128.93.243", "209.128.93.254", "62.216.234.216",
- "62.216.234.218", "62.216.234.219", "62.216.234.220", "209.128.104.18",
- "209.128.104.19", "209.128.104.20", "209.128.104.21", "209.128.104.22",
- "209.128.104.23", "209.128.104.24", "209.128.104.25", "209.128.104.26",
- "209.128.104.27", "209.128.104.28", "209.128.104.29", "209.128.104.30",
- "209.128.104.31", "209.128.104.32", "209.128.104.33", "209.128.104.34",
- "209.128.104.35", "209.128.104.36", "209.128.104.37", "99.186.243.9",
- "99.186.243.10", "99.186.243.11", "99.186.243.12", "99.186.243.13",
- "99.180.227.233", "99.180.227.234", "99.180.227.235", "99.180.227.236",
- "99.180.227.237");
- /**
- * Database settings, the variable names speak for themselfs
- */
- $db_host = "68.233.240.175";
- $db_user = "forum";
- $db_pass = "j;|L7+7)<{>O~_a";
- $db_name = "server;
- /**
- * The workings of the script
- */
- if(!@mysql_connect($db_host, $db_user, $db_pass)) {
- die(send_error("Error connecting to database server: " . mysql_error()));
- }
- if(!@mysql_select_db($db_name)) {
- die(send_error("Error selecting database: " . mysql_error()));
- }
- if (!array_search($_SERVER['REMOTE_ADDR'], $plimus_ips)) {
- die(send_error("Not a plimus server ip address " . $_SERVER['REMOTE_ADDR']));
- }
- if(isset($_POST['transactionType'])) {
- if($_POST['transactionType'] == "CHARGE") {
- $username = @mysql_real_escape_string($_POST[$username_field]);
- $item = getItemForContract(@mysql_real_escape_string($_POST['contractId']));
- if($item == 0) {
- die(send_error("no item mapped for " . $_POST['contractId'] . ""));
- }
- $quantity = @mysql_real_escape_string($_POST['quantity']);
- if(@mysql_query("INSERT INTO `plimus` (`username`, `item`, `quantity`) VALUES('" . $username . "', '" . $item . "', '" . $quantity . "');")) {
- die(send_error("Error inserting purchased item into the database " . mysql_error));
- }
- }
- }
- function getItemForContract($contract) {
- global $items;
- foreach($items as $key=>$value) {
- if($key == $contract) {
- return $value;
- }
- }
- return 0;
- }
- function send_error($error) {
- global $error_email;
- $headers = 'From: postmaster ' . "\r\n" . 'Reply-To: ' . $error_email . "\r\n" . 'X-Mailer: PHP/' . phpversion();
- mail($error_email, "Plimus IPN Error!", $error, $headers); //sec
- }
- ?>
Add Comment
Please, Sign In to add comment