-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodif.php
More file actions
48 lines (46 loc) · 1.57 KB
/
modif.php
File metadata and controls
48 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
include('include.php');
$smarty->assign('menu', 2);
if(!$_SESSION['connecte'])
{
header('location: index.php');
exit();
}
if(isset($_POST['envoi']) && $_POST['envoi'] == 1)
{
$titre = htmlspecialchars($_POST['title']);
$lien = htmlspecialchars($_POST['link']);
$id = intval($_POST['id']);
$dossier = intval($_POST['dossier']);
if(strlen($titre) > 0 && strlen($lien) > 0 && $id > 0)
$bdd->query('UPDATE framatout
SET titre = "'.$titre.'", lien = "'.$lien.'", dossier = "'.$dossier.'"
WHERE id = '.$id.' AND membre = "'.$_SESSION['courriel'].'"');
header('location: index.php');
exit();
}
$id = intval($_GET['id']);
$requete = $bdd->query('SELECT titre, lien, dossier, type FROM framatout WHERE id = '.$id.' AND membre = "'.$_SESSION['courriel'].'"');
$donnees = $requete->fetch();
if(count($donnees) == 0)
header('location: index.php');
else
{
$smarty->assign(array(
'id' => $id,
'titre' => $donnees['titre'],
'lien' => $donnees['lien'],
'type' => $donnees['type'],
'id_dossier' => $donnees['dossier']
));
$requete = $bdd->query('SELECT id, titre FROM framatout WHERE membre = "'.$_SESSION['courriel'].'" AND type = -1');
$liste_dossiers = array(array('id' => 0, 'nom' => '/'));
while($donnees = $requete->fetch())
{
$liste_dossiers[] = array( 'id' => $donnees['id'],
'nom' => '/'.$donnees['titre']);
}
$smarty->assign('liste_dossiers', $liste_dossiers);
$smarty->display("tpl/modif.tpl");
}
?>