| Server IP : 109.234.162.214 / Your IP : 216.73.216.222 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/carpe/public_html/starship/ |
Upload File : |
<?php
include 'database.php';
session_start();
$database = new Database();
$connexion = $database->getConnection();
function getId($connexion){
$username = $_SESSION['login'];
$sql = "SELECT id_user from users where username = '$username'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($results as $row) {
$id = $row['id_user'];
return $id;
}
}
$value = $_POST['toto'];
$val = 0;
if($value == "vaisseau1"){
$val = "Aurora";
//echo "Vaisseau Aurora.";
//echo "Etat proprete : 80%.";
//echo "Etat Technique : 30%.";
}if($value == "vaisseau2"){
$val = "Spectrus";
}
if($value == "vaisseau3"){
$val = "Blorps";
}
$id = getId($connexion);
$sql = "SELECT * from vaisseaux where id_user='$id' AND nom ='$val'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
//echo "nom";
//echo $value['nom'];
//echo 'okok';
$nom = $value['nom'];
$etat_p = $value['etat_proprete'];
$etat_t = $value['etat_technique'];
echo "Vaisseau $nom.";
echo "Etat proprete : $etat_p%.";
echo "Etat Technique : $etat_t%.";
if($etat_p > 70 AND $etat_t > 80){
echo "Woaw";
}else{
echo "ohhh";
}
}
//echo $id;
?>