{title='fishcoin currency converter'}
{favicon='/resources/fishcoin/fishcoin.png'}
['name' => 'US Dollar', 'rate' => 0],
'EUR' => ['name' => 'Euro', 'rate' => 0],
'GBP' => ['name' => 'British Pound', 'rate' => 0],
'JPY' => ['name' => 'Japanese Yen', 'rate' => 0],
'AUD' => ['name' => 'Australian Dollar', 'rate' => 0],
'CAD' => ['name' => 'Canadian Dollar', 'rate' => 0],
'CHF' => ['name' => 'Swiss Franc', 'rate' => 0],
'CNY' => ['name' => 'Chinese Yuan', 'rate' => 0],
'FSHC' => ['name' => 'Fish coin', 'rate' => 1],
'PHP' => ['name' => 'Philippine Peso', 'rate' => 0.000000001],
'SM64S' => ['name' => 'super mario 64 stars', 'rate' => 100000],
'LIME' => ['name' => 'lime currency', 'rate' => 0],
];
$convertResult = 'enter an amount and click convert!
*convert any world currency to FSHC*';
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
$amount = (string) ($_POST['amount'] ?? '');
$code = (string) ($_POST['currency'] ?? 'USD');
if ($amount === '') {
$convertResult = '**notice:** please enter an amount to convert.';
} elseif (!is_numeric($amount)) {
$convertResult = '**error:** please enter a valid number.';
} elseif (!isset($currencies[$code])) {
$convertResult = '**error:** currency not supported. how did you do this';
} else {
$input = (float) $amount;
$rate = $currencies[$code]['rate'];
$fshc = (int) round($input * $rate);
$convertResult = "**{$input} {$code}** converts to: ₣**{$fshc}**\n\n*exchange rate: 1 {$code} = {$rate} FSHC*";
}
}
$selected = (string) ($_POST['currency'] ?? 'USD');
$amountVal = htmlspecialchars((string) ($_POST['amount'] ?? ''), ENT_QUOTES);
?>
# world currency to fishcoin converter
{columns}
{column='left', padding='12'}
{endcolumn}
{column='right', right-align}