| 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/www/BOOM/ |
Upload File : |
<?php
class Database {
private $host = "localhost";
private $db_name = "carpe_boom";
private $username = "carpe_php";
private $password = "onestdestubesonestpasdespots";
private $conn;
public function getConnection() {
$this->conn = null;
try {
$this->conn = new PDO(
"mysql:host=" . $this->host . ";dbname=" . $this->db_name,
$this->username,
$this->password
);
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $exception) {
echo "Erreur de connexion : " . $exception->getMessage();
}
return $this->conn;
}
}
$database = new Database();
$connexion = $database->getConnection();
$cause = $_POST['toto'];
if($cause == 'un'){
$lenght = $_POST['lenght'];
$sql = "SELECT * from onomatope where nb='$lenght'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png'>";
}
}
if($cause == 'un.un'){
$lenght = $_POST['lenght'];
$value = $_POST['value'];
//echo $value;
$sql = "SELECT * from onomatope where violence = '$value' and nb='$lenght'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
if($cause == 'un.deux'){
$lenght = $_POST['lenght'];
$value = $_POST['value'];
//echo $value;
$sql = "SELECT * from onomatope where nb = '$lenght' ORDER BY classement ASC";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
if($cause == 'un.deuxdeux'){
$lenght = $_POST['lenght'];
$value = $_POST['value'];
//echo $value;
$sql = "SELECT * from onomatope where nb = '$lenght' ORDER BY classement DESC";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
if($cause == 'un.trois'){
$value = $_POST['value'];
$value2 = $_POST['value2'];
if($value2 == 'moins'){
$sql = "SELECT * from onomatope where violence = '$value' ORDER BY classement DESC";
}
if($value2 == "plus"){
$sql = "SELECT * from onomatope where violence = '$value' ORDER BY classement ASC";
}
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
if($cause == 'deux'){
$value = $_POST['value'];
//echo $value;
$sql = "SELECT * from onomatope where violence = '$value'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
if($cause == 'trois'){
$value = $_POST['value2'];
//echo $value;
if($value == "plus"){
$sql = "SELECT * FROM `onomatope` ORDER BY classement ASC";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png'>";
}
}
if($value == "moins"){
$sql = "SELECT * FROM `onomatope` ORDER BY classement DESC";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png' >";
}
}
}
if($cause == 'quatre'){
$sql = "SELECT * FROM `onomatope` ";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value){
$index = $value['id'];
echo "<img src='$index.png'>";
}
}
if($cause == 'tout'){
$lenght = $_POST['lenght'];
$value = $_POST['value'];
$value2 = $_POST['value2'];
if($value2 == "plus"){
$sql = "SELECT * FROM `onomatope` where nb='$lenght' and violence = '$value' ORDER BY classement ASC";
}
if($value2 == "moins"){
$sql = "SELECT * FROM `onomatope` where nb='$lenght' and violence = '$value' ORDER BY classement DESC";
}
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($results as $value3){
$index = $value3['id'];
echo "<img src='$index.png'>";
}
}
?>