function cost($c) { $cost = array(); if ($c['deaths']) { $cost[] = sprintf('%u death%s', $c['deaths'], $c['deaths'] == 1 ? '' : 's'); } if (@$c['injuries']) { $cost[] = sprintf('%u injured', $c['injuries']); } if (@$c['lives-at-risk']) { $cost[] = sprintf('%s lives at risk', number_format($c['lives-at-risk'])); } # because of the number of years and different currencies, convert all # non-dollar amounts to dollars inside the case studies based on # exchange rate atht the time of the incident if (@$c['dollars']) { $d = dollars($c); $cost[] = sprintf('$%s', number_format($d)); } else { if (@$c['£']) { $cost[] = sprintf('£%s', number_format($c['£'])); } else { if (@$c['€']) { $cost[] = sprintf('€%s', number_format($c['€'])); } else { if (@$c['AUD']) { $cost[] = sprintf('AUD%s', number_format($c['AUD'])); } } } } if (@$c['jobs']) { $cost[] = sprintf('%s jobs', number_format($c['jobs'])); } if (@$c['recalls']) { $cost[] = sprintf('%s recalls', number_format($c['recalls'])); } if (@$c['remote-vulnerabilities']) { $cost[] = sprintf('%s vulnerabilities', number_format($c['remote-vulnerabilities'])); } if (@$c['delay-years']) { $cost[] = sprintf('%u year delay', $c['delay-years']); } if (@$c['dollars-at-risk']) { $cost[] = sprintf('$%s at risk', number_format($c['dollars-at-risk'])); } if (@$c['delay-days']) { $cost[] = sprintf("%u day delay", $c['delay-days']); } if (!$cost) { $cost[] = 'unspecified'; } return $cost; }
<strong style="font-size:16pt"><?php echo $error; ?> </strong><br><br> <a href="index.php"><< Go Back</a> <?php } else { ?> <div class="finalinfo" style="width:250px;margin-left:200px;"> You are about to donate:<br> You will recieve:<br> To your account: </div> <div class="finalinfo" style="width:400px;"> <strong><?php echo dollars($amount); ?> </strong><br> <strong><?php echo number_format(calculate_donation_increment($steamid, $db, $amount)); ?> </strong> Points<br> <strong> <?php $players = fetch_steam_info($steamid); echo htmlspecialchars(steam_name($steamid, $players)); ?> </strong> (<?php echo steamid64ToSteamid((string) $steamid); ?>
//Log charge $db->query("INSERT INTO charges (id64, email, amount, points_before, points_after)\n\t\t\t \t\t\tVALUES (" . $db->quote($steamid) . ", " . $db->quote($_POST['stripeEmail']) . ", " . $db->quote($amount) . ", " . $db->quote($info["points"]) . ", " . $db->quote($info["points"] + $donationpoints) . ")"); //Credit user $info["points"] += $donationpoints; $info["donation_total"] += $amount; $info["donation_credited"] += $donationpoints; sql_set_info($steamid, $db, $info); ?> <h2>Donation complete - Thank you!</h2> <?php $pdata = sql_get_info($steamid, $db); $current_points = $pdata["points"]; $past_donations = $pdata["donation_total"]; $infostring = $current_points . " Points"; if ($past_donations > 0) { $infostring .= ", " . dollars($past_donations) . " Donated"; } //Workaround so we don't have to use the STEAM API again... output_steam_info($steamid, array(0 => array("steamid" => $steamid, "personaname" => $_POST["steam_personaname"], "personastate" => $_POST["steam_personastate"], "gameid" => $_POST["steam_gameid"], "avatarfull" => $_POST["steam_avatarfull"])), $infostring); ?> <p>Please rejoin the game for your points to update on the server.</p> <?php } catch (\Stripe\Error\ApiConnection $e) { output_error("Networking error ApiConnection"); } catch (\Stripe\Error\InvalidRequest $e) { output_error("Error: Form was resubmitted"); } catch (\Stripe\Error\Api $e) { output_error("Networking error Api"); } catch (\Stripe\Error\Card $e) { output_error("Error: Your card could not be charged!"); //Uncomment for more info about why cards can't be charged
function output_fixedamt($price) { ?> <div class="fixedamt"> <h2><?php echo dollars($price); ?> </h2> <p> <span class="reward">You will recieve:</span><br> <span class="points"><?php echo number_format(POINTS_PER_DOLLAR * floor($price / 100)); ?> Points</span><br> <button onclick="location.href = 'confirm.php?amount=<?php echo $price; ?> '">Select</button> </p> </div> <?php }