3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Copyright, 2014 Magictallguy This file, and all files linked to it, are to be used at Magictallguy's discretion only. If the file is removed by, or at the request of Magictallguy; then it should not be re-uploaded. If the file is re-uploaded, or not removed; Magictallguy reserves the right to have it removed by the authorities available at the time */ // tell PHP to log errors to ipn_errors.log in this directory // include(DIRNAME(__DIR__) . '/includes/dbcon.php'); // (DIRNAME(__DIR__) . '/includes/classes.php'); // initiate the IPN listener //(__DIR__ . '/ipnlistener.php'); $listener = new IpnListener(); // tell the IPN listener not to use the PayPal test sandbox $listener->use_sandbox = true; // try to process the IPN POST try { $listener->requirePostMethod(); $verified = $listener->processIpn(); } catch (Exception $e) { error_log($e->getMessage()); exit; } $errorMail = 'errors@convict-conflict.com'; // mail($errorMail, 'Payment details: everything', $listener->getTextReport()); if($verified) { if(!ctype_digit($_POST['item_number']) || !$_POST['item_number']) { mail($errorMail, 'Payment failed: no pack ID', $listener->getTextReport()); exit; } if($_POST['payment_status'] != 'Completed') { mail($errorMail, 'Payment failed: invalid status', $listener->getTextReport()); exit; } // if(!in_array(strtolower($_POST['receiver_email']), array('magictallguy_card@hotmail.co.uk', 'heres_chrissie@hotmail.co.uk'))) { if(strtolower($_POST['receiver_email']) != 'mtg@magictallguy.tk') { mail($errorMail, 'Payment failed: invalid receiver email', $listener->getTextReport()); exit; } if($_POST['mc_currency'] != 'USD') { mail($errorMail, 'Payment failed: invalid currency', $listener->getTextReport()); exit; } if($_POST['payment_type'] != 'instant') { mail($errorMail, 'Payment failed: invalid payment type', $listener->getTextReport()); exit; } if($_POST['txn_type'] != 'web_accept') { mail($errorMail, 'Payment failed: invalid transaction type', $listener->getTextReport()); exit; } $query = $mtgdb->query("SELECT `id_purchase` FROM `paypal_ipn` WHERE `ipn_data` = '".$mtgdb->escape($_POST['txn_id'])."'"); if($mtgdb->num_rows($query)) { mail($errorMail, 'Payment failed: double submission', $listener->getTextReport()); exit("You've already submitted this payment"); } $select = $mtgdb->query("SELECT * FROM `pcstore` WHERE `pack_id` = ".$_POST['item_number']); if(!$mtgdb->num_rows($select)) { mail($errorMail, 'Payment failed: Invalid Pack ID', $listener->getTextReport()); exit("Invalid pack ID"); } $row = $mtgdb->fetch_row($select); $discount = $mtgdb->fetch_single($mtgdb->query("SELECT `discount` FROM `serverconfig`")); if($discount) $row['pack_cost'] -= ($row['pack_cost'] / 100 * $discount); $custom = explode('|', $_POST['custom']); $donator = new User($custom[0], $mtgdb); if(!empty($custom[2]) && $custom[2] != '0.00') { $_POST['mc_gross'] += $custom[2]; if($donator->storeCredit < $custom[2] || $row['pack_cost'] != $_POST['mc_gross']) { mail($errorMail, 'Payment failed: Tried to cheat the Store Credit System', $listener->getTextReport()); exit; } $mtgdb->query("UPDATE `users` SET `storeCredit` = `storeCredit` - ".$custom[2]." WHERE `id` = ".$donator->id); } else { if($_POST['mc_gross'] != $row['pack_cost']) { mail($errorMail, 'Payment failed: Amount paid doesn\'t match pack: Gross: '.$_POST['mc_gross'].' | Cost: '.$row['pack_cost'], $listener->getTextReport()); exit; } } $mtgdb->query("INSERT INTO `paypal_ipn` VALUES ('', ".$donator->id.", ".time().", '".$mtgdb->escape($_POST['txn_id'])."', '".$row['pack_details']."', '".$custom[1]."', ".$_POST['mc_gross'].", '".$mtgdb->escape($_POST['payer_email'])."')"); if($row['pack_type'] == 'query') { $sql = "UPDATE `users` SET ".$row['pack_query']." WHERE `id` = ".$donator->id; mail($errorMail, 'Credit details: query check', $sql, 'From: support@convict-conflict.com'); $mtgdb->query($sql); if(preg_match('/\`bank\` ?\+ ?[0-9]+/', $row['pack_query'], $match)) translog_add($_SESSION['who'], 'rp store', 'money', preg_replace('/\`bank\` ?\+ ?/', '', $match[0])); if(preg_match('/\`points\` ?\+ ?[0-9]+/', $row['pack_query'], $match)) translog_add($_SESSION['who'], 'rp store', 'points', preg_replace('/\`points\` ?\+ ?/', '', $match[0])); if(preg_match('/\`rmdays\` ?\+ ?[0-9]+/', $row['pack_query'], $match)) translog_add($_SESSION['who'], 'rp store', 'rp days', preg_replace('/\`rmdays\` ?\+ ?/', '', $match[0])); } else if($row['pack_type'] == 'item') { $items = explode('|', $row['pack_query']); mail($errorMail, 'Credit details: queryItem/sql', print_r($items, true)."\r\n\r\n".$sql, 'From: support@convict-conflict.com'); foreach($items as $itemQty) { $item = explode(',', $itemQty); $selectItem = $mtgdb->query("SELECT `id` FROM `items` WHERE `id` = ".$item[0]); if($mtgdb->num_rows($selectItem)) { Give_Item($item[0], $donator->id, $item[1]); translog_add($donator->id, 'rp store', 'item', $item[0], $item[1]); } } mail($errorMail, 'Payment details: item check', $sql."\r\n\r\n\r\n".$listener->getTextReport()); } else { $queryItem = explode('.', $row['pack_query']); //$queryItem[0] = [The query] | $queryItem[1] = [the items/qty] $sql = "UPDATE `users` SET ".str_replace(array('[', ']'), '', $queryItem[0])." WHERE `id` = ".$donator->id; $mtgdb->query($sql); mail($errorMail, 'Credit details: queryItem/sql', print_r($queryItem, true)."\r\n\r\n".$sql, 'From: support@convict-conflict.com'); if(preg_match('/\`bank\` ?\+ ?[0-9]+/', str_replace(array('[', ']'), '', $queryItem[0]), $match)) translog_add($_SESSION['who'], 'rp store', 'money', preg_replace('/\`bank\` ?\+ ?/', '', $match[0])); if(preg_match('/\`points\` ?\+ ?[0-9]+/', str_replace(array('[', ']'), '', $queryItem[0]), $match)) translog_add($_SESSION['who'], 'rp store', 'points', preg_replace('/\`points\` ?\+ ?/', '', $match[0])); if(preg_match('/\`rmdays\` ?\+ ?[0-9]+/', str_replace(array('[', ']'), '', $queryItem[0]), $match)) translog_add($_SESSION['who'], 'rp store', 'rp days', preg_replace('/\`rmdays\` ?\+ ?/', '', $match[0])); $items = explode('|', str_replace(array('[', ']'), '', $queryItem[1])); foreach($items as $itemQty) { $item = explode(',', $itemQty); $selectItem = $mtgdb->query("SELECT `id` FROM `items` WHERE `id` = ".$item[0]); if($mtgdb->num_rows($selectItem)) { Give_Item($item[0], $donator->id, $item[1]); translog_add($donator->id, 'rp store', 'item', $item[0], $item[1]); } } mail($errorMail, 'Payment details: both check', $sql."\r\n\r\n\r\n".$listener->getTextReport()); } Send_Event(1, $donator->formattedname." [".$donator->id."] paid for ".$row['pack_name'], 'donations'); Send_Event(2, $donator->formattedname." [".$donator->id."] paid for ".$row['pack_name'], 'donations'); $selectReferral = $mtgdb->query("SELECT `referrer` FROM `referrals` WHERE `referred` = ".$donator->id); if($mtgdb->num_rows($selectReferral)) { $referrer = $mtgdb->fetch_single($selectReferral); $mtgdb->query("UPDATE `users` SET `storeCredit` = `storeCredit` + ".$mtg->formatMoney($_POST['mc_gross'] / 10, false)." WHERE `id` = ".$referrer); Send_Event($referrer, $donator->formattedname." just upgraded their account. You receive ".$mtg->formatMoney($_POST['mc_gross'] / 10)." as RP Store Credit", 'donations'); } Send_Event($donator->id, "Your ".$row['pack_name']." has been credited to you. Thank you!", 'donations'); mail($errorMail, 'Valid payment processed', $listener->getTextReport()); $selectDonCount = $mtgdb->query("SELECT `id` FROM `top_donators` WHERE `userid` = ".$donator->id); if(!$mtgdb->num_rows($selectDonCount)) $mtgdb->query("INSERT INTO `top_donators` (`userid`, `donCount`) VALUES (".$donator->id.", ".$_POST['mc_gross'].")"); else $mtgdb->query("UPDATE `top_donators` SET `donCount` = `donCount` + ".$_POST['mc_gross']." WHERE `userid` = ".$donator->id); } else { mail($errorMail, 'Invalid IPN', $listener->getTextReport()); $donator = new User($donator->id, $mtgdb); Send_Event(1, $donator->formattedname." [".$donator->id."] failed to pay for ".$row['pack_name'], 'donations'); Send_Event(2, $donator->formattedname." [".$donator->id."] failed to pay for ".$row['pack_name'], 'donations'); exit("Payment failed<br /><a href='http://convict-conflict.com'>Return to ".$mtg->gameSet('game_name')."</a>"); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.60.0130.00016.75
7.2.00.0060.00619.01
7.1.200.0080.00815.69
7.1.100.0080.00318.09
7.1.70.0050.00317.08
7.1.60.0060.01919.82
7.1.50.0100.01316.62
7.1.00.0030.07722.48
7.0.200.0000.00716.85
7.0.140.0030.07721.95
7.0.100.0430.07320.08
7.0.90.0400.08020.06
7.0.80.0330.08020.03
7.0.70.0370.08720.01
7.0.60.0530.04319.94
7.0.50.0200.07320.46
7.0.40.0030.08320.15
7.0.30.0000.07320.04
7.0.20.0130.08020.13
7.0.10.0070.05319.99
7.0.00.0000.05020.10
5.6.280.0100.06721.08
5.6.250.0130.06720.71
5.6.240.0070.04720.72
5.6.230.0030.09020.74
5.6.220.0030.07020.68
5.6.210.0100.08020.86
5.6.200.0030.04321.04
5.6.190.0070.08321.20
5.6.180.0070.07321.04
5.6.170.0030.07321.04
5.6.160.0070.06721.13
5.6.150.0030.08321.14
5.6.140.0100.04321.12
5.6.130.0070.04021.21
5.6.120.0000.04721.12
5.6.110.0070.04021.18
5.6.100.0030.04321.02
5.6.90.0030.04021.02
5.6.80.0030.03320.43
5.6.70.0000.03720.54
5.6.60.0030.03320.56
5.6.50.0070.03020.52
5.6.40.0030.03320.48
5.6.30.0100.03020.40
5.6.20.0000.04020.54
5.6.10.0070.04320.50
5.6.00.0070.03720.45
5.5.380.0070.07720.65
5.5.370.0070.07720.46
5.5.360.0070.05720.57
5.5.350.0130.07320.51
5.5.340.0000.08720.95
5.5.330.0100.04320.71
5.5.320.0030.08720.81
5.5.310.0030.04320.91
5.5.300.0030.04320.96
5.5.290.0070.04021.01
5.5.280.0030.04020.96
5.5.270.0030.04320.80
5.5.260.0030.04320.84
5.5.250.0000.04720.67
5.5.240.0070.03020.26
5.5.230.0000.03720.38
5.5.220.0070.03020.22
5.5.210.0000.03720.19
5.5.200.0100.03320.30
5.5.190.0070.08720.32
5.5.180.0000.04020.07
5.5.160.0100.02720.27
5.5.150.0030.03320.32
5.5.140.0000.04320.32
5.5.130.0030.04320.35
5.5.120.0070.03720.26
5.5.110.0030.04320.31
5.5.100.0070.03720.18
5.5.90.0030.03320.24
5.5.80.0070.02720.15
5.5.70.0100.03320.00
5.5.60.0070.03320.23
5.5.50.0030.03320.12
5.5.40.0030.03320.23
5.5.30.0070.03020.14
5.5.20.0070.03020.16
5.5.10.0100.03020.20
5.5.00.0000.03720.07
5.4.450.0100.04319.39
5.4.440.0070.03719.35
5.4.430.0030.04019.29
5.4.420.0070.03719.39
5.4.410.0100.03319.23
5.4.400.0100.03018.92
5.4.390.0030.03718.80
5.4.380.0000.04319.23
5.4.370.0000.03719.23
5.4.360.0130.05719.16
5.4.350.0030.03319.07
5.4.340.0100.05318.97
5.4.320.0000.04319.04
5.4.310.0070.04018.97
5.4.300.0030.03719.12
5.4.290.0000.03319.23
5.4.280.0030.04319.07
5.4.270.0030.03718.84
5.4.260.0030.04318.91
5.4.250.0030.04019.03
5.4.240.0030.04018.97
5.4.230.0030.04018.79
5.4.220.0070.03019.04
5.4.210.0000.03319.11
5.4.200.0170.02019.05
5.4.190.0030.03318.95
5.4.180.0030.03018.83
5.4.170.0030.03718.80
5.4.160.0030.03019.14
5.4.150.0000.03719.05
5.4.140.0070.02716.34
5.4.130.0030.03316.35
5.4.120.0000.03316.34
5.4.110.0100.02716.50
5.4.100.0030.03016.50
5.4.90.0030.03016.50
5.4.80.0000.03316.27
5.4.70.0070.02716.40
5.4.60.0070.02716.47
5.4.50.0070.07016.47
5.4.40.0100.06716.39
5.4.30.0030.04016.35
5.4.20.0030.03316.25
5.4.10.0100.06016.33
5.4.00.0100.07315.85
5.3.290.0030.04014.72
5.3.280.0070.03314.54
5.3.270.0000.03714.70
5.3.260.0070.03314.56
5.3.250.0000.03314.64
5.3.240.0000.03314.64
5.3.230.0070.03014.68
5.3.220.0170.01714.61
5.3.210.0030.03014.62
5.3.200.0000.04014.50
5.3.190.0130.03714.62
5.3.180.0100.02314.62
5.3.170.0070.03314.57
5.3.160.0030.03014.60
5.3.150.0070.03714.63
5.3.140.0100.06714.60
5.3.130.0070.03314.64
5.3.120.0070.06714.61
5.3.110.0030.07714.63
5.3.100.0000.05714.04
5.3.90.0000.04014.02
5.3.80.0070.03014.11
5.3.70.0100.05713.96
5.3.60.0100.06714.10
5.3.50.0070.07314.04
5.3.40.0030.04314.01
5.3.30.0030.03313.99
5.3.20.0070.04013.70
5.3.10.0070.04713.68
5.3.00.0000.06313.59

preferences:
32.94 ms | 400 KiB | 5 Q