pow(2,2);;
if($check !== false) {
$upload_state = 1;
} else {
$upload_state = 0;
}
if (file_exists($target_file)) {
$upload_state = 2;
}
// limite de taille
if ($_FILES["photo"]["size"] > pow(2,25)) {
$upload_state = 0;
}
// check le type de fichier
if (!in_array($imageFileType,$EXT_WHITELIST)){
$upload_state = 0;
}
$file_name = "";
switch($upload_state){
case 1:
move_uploaded_file($_FILES["photo"]["tmp_name"],$target_file);
$file_name = htmlspecialchars($_FILES["photo"]["name"]);
break;
case 2:
$file_name = htmlspecialchars($_FILES["photo"]["name"]);
break;
case 0:
?>
prepare("INSERT INTO ville_epreuve(indice,reponse,photo,id_equipe,est_finale,ordre,est_trouvee) VALUES(?,?,?,?,?,?,?)");
$req->execute(array(htmlspecialchars($_POST['indice']),
htmlspecialchars($_POST['reponse']),
$file_name,
(int)htmlspecialchars($_POST['id_equipe']),
(bool)htmlspecialchars($_POST['est_finale']),
(int)htmlspecialchars($_POST['ordre']),
false
));
}
//ajout d'une equipe
if(isset($_POST['add_equipe'])){
$req = $db->prepare("INSERT INTO ville_equipe(nom,temps) VALUES(?,?)");
$req->execute(array(htmlspecialchars($_POST['nom']),NULL));
}
// suppression d'une équipe
if(isset($_POST['del_equipe'])){
$req = $db->prepare("DELETE FROM ville_equipe WHERE id=?");
$req->execute(array(htmlspecialchars((int)$_POST['id_ekip'])));
}
//suppression d'une épreuve
if(isset($_POST['del_epreuve'])){
$req = $db->prepare("DELETE FROM ville_epreuve WHERE id=?");
$req->execute(array((int)$_POST['id_epreuve']));
}
?>
Admin / Com'ville
Equipes déjà enregistrées :
prepare('SELECT * FROM ville_epreuve WHERE id_equipe=?');
$req->execute(array($ekip));
?>
ID (db) |
Indice |
Reponse |
Photos |
Id_equipe |
Est finale |
Ordre |
Est trouvée |
Action |
fetch()) {
?>
= $epreuve['id'] ?> |
= $epreuve['indice'] ?> |
= $epreuve['reponse'] ?> |
no photos"; }?> |
= $epreuve['id_equipe'] ?> |
= $epreuve['est_finale'] == 0 ? "non":"oui" ?> |
= $epreuve['ordre'] ?> |
= $epreuve['est_trouvee'] == 0 ? "non":"oui" ?> |
|