summaryrefslogtreecommitdiff
path: root/accroche.php
blob: 7fd0994be01ac2b3b40d81ab519df551f74f6aab (plain)
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
<?php
// PAGE SÉCURISÉE ! impossible de la voir si la variable $_SESSION['mdpvalide'] ne vaut pas 1

session_start();
if (isset ($_SESSION["mdpvalide"]))
{
    if($_SESSION["mdpvalide"]) // booléen, test si ça vaut 1
    {} // dans ce cas on fait rien et on laisse php lire la suite
    else
    {
        header('Location: connexion.php');
        exit ();
        // exit() sert à interrompre php qui n'a alors surtout pas besoin d'aller jusqu'en bas de la page
    }
}
else
{
    header('Location: connexion.php');
    exit ();
}

$fichier = fopen('accroche.txt','r+');
ftruncate($fichier,0); // évite les problèmes quand on change pour un titre plus court
fputs($fichier, $_POST['accroche']);
fseek($fichier, 0);
fclose($fichier);

header('Location: administration.php?modifaccroche=1');
exit ();
?>