retour déconnexion
suppression de page
&sup= no" class="move">n o
Par phpnet, le 14.04.2010
· Un site en trois clics...
· X O
· test
Date de création : 18.03.2010
Dernière mise à jour :
14.04.2010
3 articles
ind
<?php
session_start();
include ('../connexion.php');
if(isset($_POST['submit'])){
$log=htmlspecialchars(stripcslashes($_POST['log']));
$pass=htmlspecialchars(stripcslashes($_POST['pass']));
$req=mysql_query('SELECT * From logins WHERE login="'.$log.'"&&password="'.$pass.'"');
$num=mysql_num_rows($req);
if($num!=0){
$_SESSION['admin']='ok';
header('Location:choix.php');
}else{
echo 'Veuillez saisir des identifiants corrects !';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>
<body>
<div id="papa">
<div id="cont">
<h1>Espace d'administration</h1><br />
<form id="form2" method="post" action="index.php">
<fieldset><legend>Veuiller saisir vos identifiants</legend><br />
<label for="log" class="calage">Login</label>
<input type="text" name="log" id="log" /><br /><br />
<label for="pass" class="calage">Password</label>
<input type="password" name="pass" id="pass" /><br /><br />
<input type="submit" name="submit" id="submit" value="Envoyer" />
</div>
</fieldset>
</form>
</div>
</body>
</html>
cx
<?php
session_start();
include ('../connexion.php');
if(!isset($_SESSION['admin'])){
header('Location:../index.php');
}
if(isset($_GET['logout'])){
session_destroy();
header('Location:../index.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>
<body><a href="index.php" class="move1">Retour</a><a href="../index.php" class="move">Déconnexion</a><br />
<h1>Que voulez vous faire?</h1><br /><br />
<a href="ajout.php" class="liens">Ajouter une page</a><br /><br />
<a href="supp.php" class="liens">Supprimer une page</a><br /><br />
<a href="modif.php" class="liens">Modifier une page</a><br /><br />
</body>
</html>
mf
<?php
session_start();
include ('../connexion.php');
if(!isset($_SESSION['admin'])){
header('Location:../index.php');
}
if(isset($_GET['logout'])){
session_destroy();
header('Location:../index.php');
}
$req=mysql_query('SELECT nom_page FROM contenu');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode: "textareas",
language: "fr",
theme: "advanced",
theme_advanced_blockformats : "h2,h3,h4,h5,h6,p",
theme_advanced_buttons1:
"formatselect,bold,italic,underline,strikethrought,|,justifyleft,justifycenter,justifyright,justifyfull,|,numlist,|,sub,sup,charmap,|,undo,redo,|,link,unlink",
//theme_advanced_buttons2:"",
forced_root_block:false,
force_br_newlines:true,
force_p_newlines:false,
content_css:"style.css",
});
</script>
</head>
<body>
<a href="choix.php" class="move1">Retour</a><a href="../index.php" class="move">Déconnexion</a><br />
<h1>Modification de page</h1><br /><br />
<?php
while($tab_req=mysql_fetch_array($req)){
?>
<a href="modif.php?page=<?php echo $tab_req['nom_page'] ?>"><?php echo $tab_req['nom_page']; ?></a><br />
<?php
}
if(isset($_GET['page'])){
$req2=mysql_query('SELECT * FROM contenu WHERE nom_page="'.$_GET['page'].'"');
$tab_req2=mysql_fetch_array($req2);
?><br />
<div id="papa">
<form id="form3" method="post" action="modif.php">
<fieldset><legend>Formulaire de modification</legend><br />
<label for="title" class="calage">Title</label>
<input type="text" name="title" id="title" size="52" value="<?php echo $tab_req2['title'] ?>"/><br /><br />
<label for="metad" class="calage">Méta description</label>
<input type="text" name="metad" id="metad" size="52" value="<?php echo $tab_req2['metad'] ?>"/><br /><br />
<label for="metak" class="calage">Mots-Clés</label>
<input type="text" name="metak" id="metak" size="52" value="<?php echo $tab_req2['metak'] ?>"/><br /><br />
<label for="nom_page" class="calage">Nom de page</label>
<input type="text" name="nom_page" id="nom_page" size="52" value="<?php echo $tab_req2['nom_page'] ?>"/><br /><br />
<label for="lien" class="calage">Lien (un mot simple)</label>
<input type="text" name="lien" id="lien" size="52" value="<?php echo $tab_req2['lien'] ?>" /><br /><br />
<label for="cat" class="calage">Catégorie</label>
<input type="text" name="cat" id="cat" size="52" value="<?php echo $tab_req2['cat'] ?>" /><br /><br />
<label for="titre" class="calage">Titre</label>
<input type="text" name="titre" id="titre" size="52" value="<?php echo $tab_req2['titre'] ?>" /><br /><br />
<label for="accroche" class="calage">Accroche</label>
<input type="text" name="accroche" id="accroche" size="52" value="<?php echo $tab_req2['accroche'] ?>" /><br /><br />
<label for="texte" class="calage">Texte</label>
<textarea name="texte" rows=10 cols=40><?php echo $tab_req2['texte'] ?></textarea><br /><br />
<label for="ex" class="calage">Envie d'exception</label>
<textarea name="ex" rows=10 cols=40><?php echo $tab_req2['exception'] ?></textarea><br /><br />
<label for="rev" class="calage">Rêves d'ailleurs</label>
<textarea name="rev" rows=10 cols=40><?php echo $tab_req2['reve'] ?></textarea><br /><br />
<label for="dec" class="calage">Découvertes essentielles</label>
<textarea name="dec" rows=10 cols=40><?php echo $tab_req2['decouverte'] ?></textarea><br /><br />
<input type="hidden" name="sauv" id="sauv" size="52" value="<?php echo $_GET['page'] ?>" /><br /><br />
<input type="submit" name="submit" id="submit2" value="Envoyer" />
</fieldset>
</form>
</div>
<?php }
?>
<?php
if(isset($_POST['submit'])){
$page=htmlspecialchars(stripslashes($_POST['nom_page']));
$cat=htmlspecialchars(stripslashes($_POST['cat']));
$titre=htmlspecialchars(stripslashes($_POST['titre']));
$accroche=htmlspecialchars(stripslashes($_POST['accroche']));
$title=htmlspecialchars(stripslashes($_POST['title']));
$metad=htmlspecialchars(stripslashes($_POST['metad']));
$metak=htmlspecialchars(stripslashes($_POST['metak']));
$lien=htmlspecialchars(stripslashes($_POST['lien']));
?>
<br />
<?php
$req_update=mysql_query('UPDATE contenu SET title="'.$title.'",metad="'.$metad.'",metak="'.$metak.'",nom_page="'.$page.'",lien="'.$lien.'",cat="'.$cat.'",titre="'.$titre.'",accroche="'.$accroche.'",texte="'.$_POST['texte'].'",exception="'.$_POST['ex'].'",reve="'.$_POST['rev'].'",decouverte="'.$_POST['dec'].'" WHERE nom_page="'.$_POST['sauv'].'"');
if($req_update==true){
echo 'Modification enregistrée, merci.';
}else{
echo 'la modification a échoué';
}
}
?>
</body>
</html>
at
<?php
session_start();
include ('../connexion.php');
if(!isset($_SESSION['admin'])){
header('Location:../index.php');
}
if(isset($_GET['logout'])){
session_destroy();
header('Location:../index.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode: "textareas",
language: "fr",
theme: "advanced",
theme_advanced_blockformats : "h2,h3,h4,h5,h6,p",
theme_advanced_buttons1:
"formatselect,bold,italic,underline,strikethrought,|,justifyleft,justifycenter,justifyright,justifyfull,|,numlist,|,sub,sup,charmap,|,undo,redo,|,link,unlink",
//theme_advanced_buttons2:"",
forced_root_block:false,
force_br_newlines:true,
force_p_newlines:false,
content_css:"style.css",
});
</script>
</head>
<body>
<a href="choix.php" class="move1">Retour</a><a href="../index.php" class="move">Déconnexion</a><br />
<h1>Ajout de page</h1><br /><br />
<div id="papa">
<form id="form3" method="post" action="ajout.php">
<fieldset><legend>Formulaire d'ajout</legend><br />
<label for="title" class="calage">Title</label>
<input type="text" name="title" id="title" size="52" /><br /><br />
<label for="metad" class="calage">Méta description</label>
<input type="text" name="metad" id="metad" size="52" /><br /><br />
<label for="metak" class="calage">Mots-Clés</label>
<input type="text" name="metak" id="metak" size="52" /><br /><br />
<label for="nom_page" class="calage">Nom de page</label>
<input type="text" name="nom_page" id="nom_page" size="52" /><br /><br />
<label for="lien" class="calage">Lien (un mot simple)</label>
<input type="text" name="lien" id="lien" size="52" /><br /><br />
<label for="cat" class="calage">Catégorie</label>
<input type="text" name="cat" id="cat" size="52" /><br /><br />
<label for="titre" class="calage">Titre</label>
<input type="text" name="titre" id="titre" size="52" /><br /><br />
<label for="accroche" class="calage">Accroche</label>
<input type="text" name="accroche" id="accroche" size="52" /><br /><br />
<label for="texte" class="calage">Texte</label>
<textarea name="texte" rows=10 cols=40></textarea><br /><br />
<label for="ex" class="calage">Envie d'exception</label>
<textarea name="ex" rows=10 cols=40></textarea><br /><br />
<label for="rev" class="calage">Rêves d'ailleurs</label>
<textarea name="rev" rows=10 cols=40></textarea><br /><br />
<label for="dec" class="calage">Découvertes essentielles</label>
<textarea name="dec" rows=10 cols=40></textarea><br /><br />
<input type="hidden" name="sauv" id="sauv" size="52" value="<?php echo $_GET['page'] ?>" /><br /><br />
<input type="submit" name="submit" id="submit3" value="Envoyer" />
</fieldset>
</form>
</div>
<?php
?>
<?php
if(isset($_POST['submit'])){
$page=htmlspecialchars(stripslashes($_POST['nom_page']));
$cat=htmlspecialchars(stripslashes($_POST['cat']));
$titre=htmlspecialchars(stripslashes($_POST['titre']));
$accroche=htmlspecialchars(stripslashes($_POST['accroche']));
$title=htmlspecialchars(stripslashes($_POST['title']));
$metad=htmlspecialchars(stripslashes($_POST['metad']));
$metak=htmlspecialchars(stripslashes($_POST['metak']));
$lien=htmlspecialchars(stripslashes($_POST['lien']));
$req_insert=mysql_query('INSERT into contenu(title,metad,metak,nom_page,lien,cat,titre,accroche,texte,exception,reve,decouverte)values("'.$title.'","'.$metad.'","'.$metak.'","'.$page.'","'.$lien.'","'.$cat.'","'.$titre.'","'.$accroche.'","'.$_POST['texte'].'","'.$_POST['ex'].'","'.$_POST['rev'].'","'.$_POST['dec'].'")');
?>
<br /><br /><br /><br />
<?php
if($req_insert==true){
echo 'La page a bien été ajoutée';
}else{
echo 'L\'ajout de page a échoué';
}
}
?>
</body>
</html>
cs
.calage{
display:inline;
float:left;
width:200px;
margin-left:25px;
font-family:verdana;
font-size:14px;
color:#86c4d4;
}
#submit{
margin-left:200px;
}
#submit2{
margin-left:400px;
}
#submit3{
margin-left:535px;
}
#form2{
width:500px;
}
a.move1{
margin-left:900px;
}
a.move{
margin-left:20px;
}
a.move:link,a.move:active,a.move:visited{
text-decoration:none;
font-family:verdana;
font-size:14px;
color:green;
}
a.move:hover{
text-decoration:underline;
}
a.move1:link,a.move1:active,a.move1:visited{
text-decoration:none;
font-family:verdana;
font-size:14px;
color:green;
}
a.move1:hover{
text-decoration:underline;
}
a:link,a:active,a:visited{
text-decoration:none;
font-family:verdana;
font-size:14px;
color:black;
}
a:hover{
text-decoration:underline;
}
h1{
color:#5b97cd;
font-family:verdana;
font-size:24px;
font-weight:normal;
text-align:center;
}
#cont{
width:500px;
margin:auto;
}
#papa{
width:900px;
height:500px;
margin:auto;
text-align:left;
}
body{
text-align:center;
}
legend{
color:red;
font-family:verdana;
font-size:15px;
}