1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| <?php
$price_list = [
'0' => ['premium' => 0, 'best' => 0],
'512 K' => ['premium' => 5161, 'best' => 2150],
'1 M' => ['premium' => 10080, 'best' => 4200],
'2 M' => ['premium' => 20160, 'best' => 8400],
'3 M' => ['premium' => 30240, 'best' => 12600],
'4 M' => ['premium' => 40320, 'best' => 16800],
'5 M' => ['premium' => 50400, 'best' => 21000],
'6 M' => ['premium' => 60480, 'best' => 25200],
'7 M' => ['premium' => 70560, 'best' => 29400],
'8 M' => ['premium' => 80640, 'best' => 33600],
'9 M' => ['premium' => 90720, 'best' => 37800],
'10 M' => ['premium' => 100800, 'best' => 42000],
'20 M' => ['premium' => 163800, 'best' => 54600],
'30 M' => ['premium' => 170200, 'best' => 60400],
'40 M' => ['premium' => 201600, 'best' => 70200],
'50 M' => ['premium' => 252000, 'best' => 84000],
'100 M' => ['premium' => 340200, 'best' => 113400]
];
$offers = [0 => true, 'best' => '"Best effort"', 'premium' => 'Prioritaire'];
$local_offer = (isset($_POST['local_offer'], $offers[$_POST['local_offer']])) ? $_POST['local_offer'] : false;
$local_speed = (isset($_POST['local_speed'], $price_list[$_POST['local_speed']])) ? $_POST['local_speed'] : false;
$inter_offer = (isset($_POST['inter_offer'], $offers[$_POST['inter_offer']])) ? $_POST['inter_offer'] : false;
$inter_speed = (isset($_POST['inter_speed'], $price_list[$_POST['inter_speed']])) ? $_POST['inter_speed'] : false;
if (($local_speed !== false) and ($inter_speed !== false) and ($local_offer !== false) and ($inter_offer !== false))
{
$total_price = 0;
if ($local_offer != 0)
$total_price += $price_list[$local_speed][$local_offer];
if ($inter_offer != 0)
$total_price += $price_list[$inter_speed][$inter_offer];
echo 'Votre prix est de ', $total_price, ' Fxpf';
}
?>
<br>--- ACCES INTERNET ---<br>
Accès réseau local :
<select name="local_speed">
<option value="0" selected="selected">-</option>
<?php foreach (array_slice($price_list, 1) as $k => $v) { ?>
<option value="<?=$k?>"><?=$k?>bits/s</option>
<?php } ?>
</select><br>
Type de service :
<select name="local_offer">
<option value="0" selected="selected">-</option>
<?php foreach (array_slice($offers, 1) as $k => $v) { ?>
<option value="<?=$k?>"><?=$v?></option>
<?php } ?>
</select><br><br>
Accès réseau internationnal :
<select name="inter_speed">
<option value="0" selected="selected">-</option>
<?php foreach (array_slice($price_list, 1, 11) as $k => $v) { ?>
<option value="<?=$k?>"><?=$k?>bits/s</option>
<?php } ?>
</select><br>
Type de service :
<select name="inter_offer">
<option value="0" selected="selected">-</option>
<?php foreach (array_slice($offers, 1) as $k => $v) { ?>
<option value="<?=$k?>"><?=$v?></option>
<?php } ?>
</select><br> |
Partager