» Rubriques
[Texte]
[SQL]
[Function]
[Maths]
[Divers]
[Variables]
[FTP]
[Email]
[Date]
[Regex]
Maintenance de site
<!-- FICHIER index.php -->
<?
echo'<html><head>';
//début de maintenance
include("under/maint.inc.php");
$maintenance=$oui_non;
if(@$maintenance==1){
include("out.php");
exit;
}//fin de maintenance
echo'<title>Votre site</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/css.css" type=text/css rel=stylesheet>
</head>';
echo'<body >
<p align="center"><strong><font color="#000000" size="4">MAINTENANCE DE SITE</font></strong></p>
<p><strong>Petite application avec variable...pour mettre un site en maintenance
à l\'aide d\'un formulaire!</strong></p>
<p><strong>Afin d\'apprécier son fonctionnement cliquez sur le lien ci dessous.</strong></p>
<p align="center"><em><font color="#006699">Maintenance <a href="under/index.php">oui</a></font></em></p>
<p><em><font color="#006699">* Il est conseillé de mettre dans le répertoire
de traitement un .htaccess par sécurité.</font></em></p>
<p><em><font color="#006699">* Vérifiez également les droits d\'écriture
sur vos fichiers .</font></em></p>
<p align="center"><a href="mailto:mlionet@mlionet.com">mlionet.com</a> ©
2003</p>
</body>
</html>';
?>
<!-- FICHIER out.php -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Maintenance </title>
<link href="css/css.css" type=text/css rel=stylesheet>
</head>
<body>
<div align="center">
<p><img src="under/maintenance.gif" width="282" height="168"></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Le site </strong> est en maintenance</font>,</p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nous sommes désolés pour la gène occasionée ...</font></p>
<p><a href="mailto:mlionet@mlionet.com">mlionet.com</a> © 2003</p>
</div>
</body>
</html>
<!-- Dossier under qui contient un index.php -->
<?
echo'<html><head>
<title>Site en maintenance</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/css.css" type=text/css rel=stylesheet>
</head>
<body>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<blockquote><br />
<strong>Mettre le site en maintenance:</strong><br>
<br />
Le site est actuellement :';
include("maint.inc.php");
$maintenance=$oui_non;
if(@$maintenance==1){
echo' <font color="red"><b>en maintenance.</b></font>';
}else{
echo' <font color="red"><b>en ligne.</b></font>';
}
echo' <form name="maint" method="post" action="">
<label>
<input type="radio" name="radiobutton" value="1">
maintenance oui <br />
<input name="radiobutton" type="radio" value="0" checked>
maintenance non<br />
</label>
<label>
<input type="submit" name="Submit" value=" maintenance ">
</label>
</form>
<br>';
if (@$Submit){
$fp=fopen("maint.inc.php","w+");
fwrite($fp,"<?php\n");
fwrite($fp,"\$oui_non=\"$radiobutton\";\n");
fwrite($fp,"?>\n");
fclose($fp);
echo'<meta http-equiv="refresh" content="3;URL=index.php">';
echo'<p><strong>Patientez 3 secondes - vos données sont transférées</strong></p>';
}else{
echo'';
}
echo'<br /><a href="../">Retour sur le site</a></blockquote></td></tr></table>
</body>
</html>';
?>
<!-- FICHIER maint.inc.php -->
<?php
$oui_non="0";
?>
/////
//une image
maintenance.gif (non fournis);)
////////
//un dossier css avec un fichier css.css
//////////
/* Barre de Défillement (Internet Exploreur >= 5.5 uniquement) --- */
BODY
{
scrollbar-face-color: #FFFFFF;
scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF;
scrollbar-3dlight-color: #CC3333;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #CC3333;
}
body { color: #000000; background-color: #FFFFFF ;leftmargin :0; topmargin:0; marginwidth:0; marginheight:0;}
/* Style des Liens ------------------------------------#5B5B5B */
A:link {font-family:verdana; font-size:9px; text-decoration: none; color: #C2A945;}
A:visited {font-family:verdana; font-size:9px; text-decoration: none; color: #800000;}
A:active {font-family:verdana; font-size:9px; text-decoration: none; color: #400000;}
A:hover {font-family:verdana; font-size:9px; text-decoration: underline; color: #FFFFFF;background-color: #800000; }
.small {font-family:verdana; font-size:9px; text-decoration: none; color: #800000;text-decoration: underline }
.titre {font-family:verdana; font-size:16px; color: #CC3333;font: bold ;font-family: Courier New, Courier, mono; }
.copy {font-family:arial; font-size:9px; text-decoration: none;color: #FFFFFF; text-align:center ; font: bold;background-color: #C2A945; }
.menu {font-family:arial; font-size:12px; text-decoration: none;color: #B3B300;background-color: #800000;}
Posté par Lionel le 20/01/2004 à 23:45
Lister un dossier
Une solution pour lister un dossier facilement.
<?php
// Configuration
$dossier = 'dossier/';
$ouverture = opendir($dossier);
// Stockage des variables
$contenu = array();
while ($fichiers = readdir($ouverture)){
if (is_file($dossier.$fichiers)){
$contenu[] = $fichiers;
}
}
closedir($ouverture);
// Affichage + traitement
echo '<h2>Index de '.$dossier.'</h2>';
foreach ($contenu as $liste_fichiers) {
// On récupère les icons à afficher
$path = '/usr/local/apache/htdocs/icons/';
$fichier = explode('.', $liste_fichiers);
// On attribut les type de fichiers et d'icones en fonction de leur extension (images personalisables)
$in = array ('gif', 'jpg', 'png', 'mid');
$out = array ($path.'image2.gif', $path.'image2.gif', $path.'image2.gif', $path.'sound2.gif');
// On les remplaces
$type = str_replace($in, $out, $fichier[1]);
echo '<img src="'.$type.'"> <a href="'.$dossier.$liste_fichiers.'">'.$liste_fichiers.'</a><br />';
}
?>
Posté par Guillaume le 20/01/2004 à 07:38
Date de Mise à jour de site
<!-- FICHIER index.php -->
<html>
<head>
<title>Mise à jour</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
body {
background-color:#FFFFFF;
color: #333333;
font-family : "Comic Sans MS", Arial, Georgia, Times, serif;
font: normal 10px arial;
}
.ajour{
border-right: #9cb4ce 1px dotted;
border-top: #9cb4ce 1px dotted;
font-size: 12px;
margin: 0px 0px 10px;
border-left: #9cb4ce 1px dotted;
color: #000000;
border-bottom: #9cb4ce 1px dotted;
font-family: "Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
background-color: #F7FAFB;
}
a {
color: #003f7d;
}
a:visited {
color: #333333; background-color: transparent
}
a:active {
color: #26469b; background-color: transparent;
}
a:hover {
color: #333399; background-color: #FFFFFF;border-left: #FFFF99 4px dotted;
}
.copy{
border-bottom: #9cb4ce 1px dashed;
font-weight: bold;
font-size: 16px;
margin: 0px 0px 5px;
color: #000000;
font-family: "Comic Sans MS", Verdana, serif;
background-color: #f7f9fd
}
.header {
background-color: #000080;
border: 1px dotted #9cb4ce;
font-family : "Comic Sans MS", Arial, Georgia, Times, serif;
text-align: left;
vertical-align: center;
font: normal 44px arial;
font-weight : bold;
color: #FFFFFF;
margin:1px;
height: 70px;
}
</style>
</head>
<body>
<?
if (file_exists("mise_a_jour.inc")) include ("mise_a_jour.inc");//date de mise à jour
?>
<div class="header">
<center>MISE A JOUR</center>
</div>
<br />
<div class="ajour">
<p><b>Dernière mise à jour: </b><br />
<? echo $a_jour ;?> <br />
</p>
<p align="center"><b>INDEX DU SITE</b></p>
</div>
<blockquote>
<div class="ajour">Utilisation d'un fichier texte pour donner la date et l'heure
de la mise à jour d'un site. Ceci après accès à
une zône d'administration d'un site!</div>
</blockquote>
<div class="ajour">
<p align="center"><b> Faire la mise à jour du <a href="mise_a_jour.php?p=maj">site</a></b><br />
</p>
</div>
<div class="copy"><center><a href="mailto:mlionet@mlionet.com?subject=A propos de Mise à jour">mlionet.com -2003</a></center></div>
</body>
</html>
<!-- FICHIER mise_a_jour.php -->
<html>
<head>
<title>Mise à jour</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
body {
background-color:#FFFFFF;
color: #333333;
font-family : "Comic Sans MS", Arial, Georgia, Times, serif;
font: normal 10px arial;
}
.ajour{
border-right: #9cb4ce 1px dotted;
border-top: #9cb4ce 1px dotted;
font-size: 12px;
margin: 0px 0px 10px;
border-left: #9cb4ce 1px dotted;
color: #000000;
border-bottom: #9cb4ce 1px dotted;
font-family: "Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
background-color: #F7FAFB;
}
a {
color: #003f7d;
}
a:visited {
color: #333333; background-color: transparent
}
a:active {
color: #26469b; background-color: transparent;
}
a:hover {
color: #333399; background-color: #FFFFFF;border-left: #FFFF99 4px dotted;
}
.copy{
border-bottom: #9cb4ce 1px dashed;
font-weight: bold;
font-size: 16px;
margin: 0px 0px 5px;
color: #000000;
font-family: "Comic Sans MS", Verdana, serif;
background-color: #f7f9fd
}
.header {
background-color: #000080;
border: 1px dotted #9cb4ce;
font-family : "Comic Sans MS", Arial, Georgia, Times, serif;
text-align: left;
vertical-align: center;
font: normal 44px arial;
font-weight : bold;
color: #FFFFFF;
margin:1px;
height: 70px;
}
</style>
</head>
<body>
<?
if (file_exists("mise_a_jour.inc")) include ("mise_a_jour.inc");//date de mise à jour
if(@$p==maj)
{
$mise= date("\L\e\ j M Y \à\ H \h i \m\n.");
$fp=fopen("mise_a_jour.inc","w+");
fwrite($fp,"<?php\n");
fwrite($fp,"\$a_jour=\"$mise\";\n");
fwrite($fp,"?>\n");
fclose($fp);
}
?>
<div class="header">
<center>MISE A JOUR</center>
</div>
<br />
<div class="ajour">
<p><b>Dernière mise à jour: </b><br />
<? echo $a_jour ;?> <br />
</p>
<p align="center"><strong>ZONE D'ADMINISTRATION DU SITE</strong></p>
</div>
<blockquote>
<div align="left" class="ajour">Ici le fichier est créé automatiquement
dés l'accès à la zône d'administration! Il suffit
d'inclure le fichier créé à l'endroit désiré
sur votre index. </div>
<div align="left" class="ajour">* Ne pas oublier de vérifier les droits
en écriture sur le fichier inclus!</div>
</blockquote>
<div class="ajour">
<p align="center"><b> Retour <a href="index.php">site</a></b><br />
</p>
</div>
<div class="copy"><center><a href="mailto:mlionet@mlionet.com?subject=A propos de Mise à jour">mlionet.com -2003</a></center></div>
</body>
</html>
Posté par Lionel le 10/01/2004 à 22:26