| Server IP : 167.99.254.82 / Your IP : 216.73.216.231 Web Server : Apache System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/factures/public_html/ |
Upload File : |
<?php
session_start();
if (!isset($_SESSION['compte_user']))
{
header('Location: erreur_surfing.html');
exit();
}
$target_dir = "images/upload_users/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
$uploadOk = 1;
} else {
$uploadOk = 0;
}
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 200000000) {
echo "<h1>Dsl, taille image large</h1>";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" ) {
echo "<h1>Dsl, Seul les formats JPG, JPEG, PNG sont autorisé</h1>";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "<h1>Dsl, opération upload terminée avec erreur !!</h1>";
echo $imageFileType;
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
//echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
//echo " <br>". $target_file;
$link = mysql_connect("localhost", "factures", "EoM6IJlnirGIfcu") or die("Impossible de se connecter : " . mysql_error());
mysql_select_db('factures', $link) or die('Erreur Serveur Base de donnees');
// Insertion
$reponse = "UPDATE comptes_user SET pic_user = '$target_file' where id_clt = $_SESSION[clt] ;";
mysqli_query($link,$reponse);
mysql_close($link);
header('Location: editer_Client.php');
exit();
} else {
echo "<h1>Dsl, opération upload terminée avec erreur !!</h1>";
}
}
?>