case PACKAGE4_DIAMONDS_ID: $diamonds = PACKAGE4_DIAMONDS_COUNT; $amount = PACKAGE4_DIAMONDS_COST; break; case PACKAGE5_DIAMONDS_ID: $diamonds = PACKAGE5_DIAMONDS_COUNT; $amount = PACKAGE5_DIAMONDS_COST; break; } $valid_transction = validTransction($transaction_id); $valid_request = detectLevel6Request(); $level = User::getUserLevel($udid); if ($valid_request) { if (DiamondPurchasedHistory::addPurchasedDiamond($udid, $amount, $diamonds, $product_id, $transaction_id, $purchase_date, $app_item_id, $quantity, $bid, $bvrs, $valid_transction, $level)) { if (User::userExists($udid) != null && $valid_transction) { if (User::addUserPurchasedDiamonds($udid, $diamonds)) { echo "success"; exit; } else { $fp = fopen('log.txt', 'a'); fwrite($fp, 'Enable award diamond to user' . date('l jS \\of F Y h:i:s A') . "\r\n"); foreach ($recipt as $key => $value) { fwrite($fp, $key . '=>' . $value . "\r\n"); } fwrite($fp, 'udid=>' . $udid . "\r\n"); fwrite($fp, 'amount=>' . $amount . "\r\n"); fclose($fp); echo "failure"; exit; } } else {