| 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/foot/ |
Upload File : |
<?php
session_start();
$serveur = "localhost";
$utilisateur = "carpe_php";
$mot_de_passe = "onestdestubesonestpasdespots";
$base_de_donnees = "carpe_foot";
$mysqli = mysqli_connect($serveur, $utilisateur, $mot_de_passe, $base_de_donnees);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Club Mmi</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
</head>
<style type="text/css">
body{
margin: 0;
padding: 0;
font-family: "Poppins", sans-serif;
font-weight: 100;
font-style: normal;
background-image: url('foot.jpg');
background-size: cover;
background-attachment: fixed;
width: 100%;
height: 100vh;
}
.page{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
#page2{
display: none;
height: auto;
padding-bottom: 100Px;
height:100vh;
}
#page3{
display: none;
height: 100%;
}
#page4{
display: none;
padding-bottom: 100Px;
margin-top: 100px;
height: auto;
}
#contain{
background:rgb(255, 255, 255, 0.9);
margin: 0;
padding: 0;
width: 90%;
height: 80%;
display: flex;
align-items: center;
overflow: hidden;
border-radius: 20px;
}
#form{
margin: auto;
/* background: red;*/
width: 50%;
height: 80%;
display: flex;
justify-content: center;
flex-wrap: wrap;
}
#form h2{
width: 100%;
text-align: center;
}
#form p{
text-align: center;
}
#maillot{
width: 100%;
}
#bah{
width:40%;
}
#text{
/* background: green;*/
height: auto;
width: 100%;
}
#text h2{
font-size: 2rem;
}
#text p{
font-size: 1.5rem;
font-weight: 400;
text-decoration: underline;
}
#options{
/* background: pink;*/
width: 100%;
height: 60%;
display: flex;
align-items: center;
flex-wrap: wrap;
}
#options div{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#options button{
all:initial;
margin: 10px;
font-family: "Poppins", sans-serif;
font-size: 1.4rem;
background: rgba(0, 0, 0, 0.6);
color: white;
padding: 5px 5px 5px 10px;
border-radius: 10px;
cursor: pointer;
}
#options p{
font-weight: 400;
font-size: 1.2rem;
}
#contain2{
position: relative;
top: 50px;
width: 80%;
height: auto;
border-radius: 20px;
background: rgba(0, 0, 0, 0.8);
color: white;
display: flex;
flex-wrap:wrap;
justify-content: center;
}
#contain2 h2{
text-align: center;
margin: 0;
padding: 0;
/* background: green;*/
width: 100%;
}
#contain h3{
padding: 0;
margin: 0;
}
.img{
width: 100%;
height: 200px;
}
.el{
margin: 10px;
/* background: red;*/
width: 200px;
height: auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.el h3{
text-align: center;
/* background: red;*/
}
.blanc{
background: white;
width: 100%;
height: auto;
color: black;
font-weight: 400;
text-align: center;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
}
#close{
position: fixed;
padding: 10px 20px 10px 20px;
background: white;
top: 0;
left: 0;
margin: 20px;
font-weight: 400;
border-radius: 50%;
cursor: pointer;
display: none;
}
#contain4{
position: relative;
top: 50px;
width: 80%;
height: 60%;
border-radius: 20px;
background: rgba(0, 0, 0, 0.8);
color: white;
display: flex;
flex-wrap:wrap;
justify-content: center;
align-items: center;
}
#contain4 form{
width: auto;
/* background: red;*/
}
.norm{
font-weight: 400;
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px;
}
.submit{
/* background: blue;*/
display: flex;
justify-content: center;
text-align: center;
width: 100%;
}
#contain5{
position: relative;
width: 60%;
height: auto;
border-radius: 20px;
background: rgba(0, 0, 0, 0.8);
color: white;
display: flex;
flex-wrap:wrap;
justify-content: center;
align-items: center;
}
.el2{
width: 100%;
display: flex;
align-items: center;
margin: 20px;
/* background: red;*/
/* justify-content: space-between;*/
justify-content: center;
}
.el2 h3{
margin: 20px;
}
.el2 img{
width: 100px;
height: 100px;
}
.el2 h2{
margin: 20px;
}
#verify{
position: absolute;
width: 50%;
height: 20%;
border-radius: 20px;
background: rgba(0, 0, 0, 0.8);
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: 400;
}
.il{
/* background: red;*/
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.il img{
width: 200px;
height: 200px;
margin: 20px;
}
.il2{
/* background: green;*/
}
.il2 div{
width: 100%;
display: flex;
justify-content: space-between;
}
.end{
display: flex;
justify-content: center;
}
.end input{
margin: 20px;
}
.
</style>
<body>
<div id="close">X</div>
<div id="page1" class="page">
<div id="contain">
<div id="bah">
<img id="maillot" src="maillot.jpeg">
</div>
<div id="form">
<div id="text">
<h2>Club MMI 1</h2>
<p>Bienvenue sur le club de foot OFFICIEL des MMI 1</p>
<p>(Mdp admin : Banane )</p>
</div>
<div id="options">
<div>
<button id="afficher">Afficher</button><p>tous les joueurs du club</p>
</div>
<div>
<button id="inserer">Insérer</button><p>un nouveau joueur au club</p>
</div>
<div>
<button id="edit">Editer / Supprimer</button><p>les joueurs du club deja présents</p>
</div>
</div>
</div>
</div>
</div>
<div id="page2" class="page">
<div id="contain2">
<h2>Pensez à réactualiser la page !</h2>
<?php
$error_msg="";
$sql_select = "SELECT * FROM infos order by poste";
$result_select = $mysqli->query($sql_select);
$index=0;
$dossier = "uploads";
while ($infos = $result_select->fetch_assoc()) {
$nom=$infos['nom'];
if ($handle = opendir($dossier)) {
while (false !== ($fichier = readdir($handle))) {
if (is_file($dossier . "/" . $fichier) && getimagesize($dossier . "/" . $fichier)) {
$name=$nom.".png";
if($name==$fichier){
// echo "<tr><td>Nom : ". $infos['nom'] . "</td><td> Prénom : ". $infos['prenom'] . "</td><td> Poste : ". $infos['poste'] . "</td><td><img src='uploads/$fichier' class='img'></td></tr><br> ";
echo "<div class='el'><img src='uploads/$fichier' class='img'><h2>". $infos['nom'] . " ". $infos['prenom'] . "</h2><h3>Poste : ". $infos['poste'] . "</h3></div>";
}
}
}
closedir($handle);
}
}
?>
</div>
</div>
<div id="page3" class="page">
<div id="contain4">
<form action="home.php" method="POST" enctype="multipart/form-data">
<input type="file" name="image" >
<div class="norm">
<label>Nom : </label>
<input type='text' name='nom'maxlength="20">
</div>
<div class="norm">
<label>Prénom : </label>
<input type='text' name='prenom' maxlength="20">
</div><div class="norm">
<label>Poste : </label>
<!-- <input type='select' name='poste'> -->
<select id="poste" name="poste">
<option value="Gardien">Gardien</option>
<option value="Defenseur">Defenseur</option>
<option value="Milieu">Milieu</option>
<option value="Attaquant">Attaquant</option>
<option value="Ailié">Ailier</option>
<option value="Remplacent">Remplacent</option>
<option value="Coach">Coach</option>
<option value="Entraineur">Entraineur</option>
</select>
</div>
<div class="norm">
<label>Admin Mdp : </label>
<input type="password" name="send_mdp">
</div>
<div class="submit">
<input type='submit' name='send2'>
</div>
<h2>Evitez les espaces et caractères spéciaux !</h2>
<?php
$sql_select = "SELECT * FROM infos";
$result_select = $mysqli->query($sql_select);
$sql_mdp = "SELECT * FROM mdp";
$result_mdp = $mysqli->query($sql_mdp);
if(isset($_POST["send2"])){
while ($infos_mdp = $result_mdp->fetch_assoc()) {
$varname = $infos_mdp['mdp'];
if(!empty($_POST['send_mdp'])){
$try = addslashes($_POST['send_mdp']);
if(password_verify($try, $varname)){
if(!empty($_POST['nom']) AND !empty($_POST['prenom']) AND !empty($_POST['poste']) AND isset($_FILES['image']) && $_FILES['image']['error']==0){
$nom = addslashes($_POST['nom']);
$prenom = addslashes($_POST['prenom']);
$poste = addslashes($_POST['poste']);
$index=0;
while ($infos = $result_select->fetch_assoc()) {
// echo $infos['nom'];
if($infos['nom']==$nom){
$index++;
}
}
if($index>0){
$error_msg= 3;
}else{
$sql_insert = "INSERT INTO `infos`(`nom`, `prenom`, `poste`) VALUES ('$nom','$prenom','$poste')";
$result_insert = $mysqli->query($sql_insert);
// echo '<script>setTimeout(function(){ location.reload(); }, 2000);</script>';
$error_msg="";
if(isset($_FILES["image"])){
// echo "string";
if ($_FILES["image"]["error"] == UPLOAD_ERR_OK) {
$temp_name = $_FILES["image"]["tmp_name"];
$name = $nom.".png";
move_uploaded_file($temp_name, "uploads/$name");
}
}
}
}else{
$error_msg=1;
// echo "<script>alert('Remplir tous les champs');</script>";
}
}else{
$error_msg=2;
}
}else{
$error_msg=1;
}
}
// echo $error_msg;
}
if($error_msg==1){
echo "<script>alert('Remplir tous les champs');</script>";
}
if($error_msg==2){
echo "<script>alert('Mauvais Mdp');</script>";
}
if($error_msg==3){
echo "<script>alert('Utilisateur Existe Deja');</script>";
}
?>
</form>
</div>
</div>
<div id="page4" class="page">
<div id="contain5">
<?php
$sql_select = "SELECT * FROM infos";
$result_select = $mysqli->query($sql_select);
$index=0;
$dossier = "uploads";
while ($infos = $result_select->fetch_assoc()) {
$nom=$infos['nom'];
if ($handle = opendir($dossier)) {
while (false !== ($fichier = readdir($handle))) {
if (is_file($dossier . "/" . $fichier) && getimagesize($dossier . "/" . $fichier)) {
$name=$nom.".png";
if($name==$fichier){
// echo "<div class='el'><img src='uploads/$fichier' class='img'><h2>". $infos['nom'] . " ". $infos['prenom'] . "</h2><h3>Poste : ". $infos['poste'] . "</h3></div>";
// echo "<div class='el2'><div><img src='uploads/$fichier' class='img'><h2>". $infos['nom'] . " ". $infos['prenom'] . "</h2></div><div><h3>Editer</h3><h3>Supprimer</h3></div></div>";
echo "<div class='el2'>
<div class='il'>
<img src='uploads/$fichier' class='img'>
</div>
<form method='POST' action='home.php' enctype='multipart/form-data'>
<input type='file' name='image' >
<div class='il2'>
<div>
<label>Nom : </label><input type='text' name='new_name' value='". $infos['nom'] . "'>
</div>
<div>
<label>Prenom : </label><input type='text' name='new_surname' value='". $infos['prenom'] . "'>
</div>
<div>
<label>Poste : </label>
<select name='poste2'>
<option value='". $infos['poste'] . "' selected >". $infos['poste'] . "</option>
<option value='Gardien'>Gardien</option>
<option value='Defenseur'>Defenseur</option>
<option value='Milieu'>Milieu</option>
<option value='Attaquant'value>Attaquant</option>
<option value='Ailié''>Ailier</option>
<option value='Remplacent'>Remplacent</option>
<option value='Coach'>Coach</option>
<option value='Entraineur'>Entraineur</option>
</select>
</div>
<div>
<label>Mdp : </label>
<input type='password' name='check'>
</div>
</div>
<div class='end'>
<input type='submit' name='update". $infos['nom'] ."'>
<input type='submit' name='reset". $infos['nom'] ."' value='Supprimer'>
</div>
</form>
</div>";
if(isset($_POST["reset". $infos['nom'] .""])){
while ($infos_mdp = $result_mdp->fetch_assoc()) {
$varname = $infos_mdp['mdp'];
if(!empty($_POST['check'])){
$try = $_POST['check'];
if(password_verify($try, $varname)){
$sql_supp = "DELETE FROM infos WHERE nom ='$nom'";
$result_supp = $mysqli->query($sql_supp);
}else{
$error_msg=2;
}
}else{
$error_msg=1;
}
}
if($error_msg==1){
echo "<script>alert('Remplir tous les champs');</script>";
}
if($error_msg==2){
echo "<script>alert('Mauvais Mdp');</script>";
}
}
if(isset($_POST["update". $infos['nom'] .""])){
$error_msg="";
while ($infos_mdp = $result_mdp->fetch_assoc()) {
$varname = $infos_mdp['mdp'];
// echo "$varname";
if(!empty($_POST['check'])){
$try = addslashes($_POST['check']);
// echo "$try";
if(password_verify($try, $varname)){
// echo "string";
$newname= addslashes($_POST['new_name']);
$newsurname=addslashes($_POST['new_surname']);
$choix=$_POST['poste2'];
$realname = $newname . ".png";
$caca="caca.png";
$error_msg="";
if(isset($_FILES["image"])){
// echo "string";
if ($_FILES["image"]["error"] == UPLOAD_ERR_OK) {
//echo "caaaaaaaaaaaaaaaaaaaaaaaaaaaacacaacacac";
$temp_name = $_FILES["image"]["tmp_name"];
$name = $newname.".png";
move_uploaded_file($temp_name, "uploads/$name");
}else{
rename("uploads/$name","uploads/$realname");
}
}else{
// echo "caaaaaaaaaaaaaaaaaaaaaaaaaaaacacaacacac";
}
// echo "$nom";
$sql_update = "UPDATE infos SET `nom`='$newname',`prenom`='$newsurname',`poste`='$choix' WHERE nom ='$nom'";
$result_update = $mysqli->query($sql_update);
}else{
$error_msg=2;
}
}else{
$error_msg=1;
}
}
if($error_msg==1){
echo "<script>alert('Remplir tous les champs');</script>";
}
if($error_msg==2){
echo "<script>alert('Mauvais Mdp');</script>";
}
// echo "$error_msg";
// echo "update". $infos['nom'] ."";
}
// if(isset($_POST['update'. $infos['nom'] .''])){
// $newname= $_POST['new_name'];
// $newsurname=$_POST['new_surname'];
// $choix=$_POST['poste2'];
// echo "$choix";
// echo "$newname";
// echo "$newsurname";
// echo "$nom";
// $sql_update = "UPDATE infos SET `nom`='$newname',`prenom`='$newsurname',`poste`='$choix' WHERE nom ='$nom'";
// $result_update = $mysqli->query($sql_update);
// }
}
}
}
closedir($handle);
}
}
?>
</div>
</div>
</body>
</html>
<script type="text/javascript">
let bouton1=document.getElementById('afficher')
let bouton2=document.getElementById('inserer')
let bouton3=document.getElementById('edit')
let page1=document.getElementById('page1')
let page2=document.getElementById('page2')
let page3=document.getElementById('page3')
let page4=document.getElementById('page4')
let close=document.getElementById('close')
let verify=document.getElementById('verify');
bouton1.addEventListener("click", () => {
page1.style.display="none";
page2.style.display="flex";
close.style.display="block";
})
bouton2.addEventListener("click", () => {
page1.style.display="none";
page3.style.display="flex";
close.style.display="block";
// verify.style.display="flex";
})
bouton3.addEventListener("click", () => {
page1.style.display="none";
page4.style.display="flex";
close.style.display="block";
})
close.addEventListener("click", () => {
page1.style.display="flex";
page2.style.display="none";
page3.style.display="none";
page4.style.display="none";
close.style.display="none";
verify.style.display="none";
})
</script>