Configuration du site
if ($chemin[2] == "accueil")
{
$file = dirname(__FILE__)."/../data/accueil.txt";
if ($_POST['contenu'])
{
$handle = fopen($file,"w") or die("CANT WRITE FILE $file");
$contenu = stripslashes($_POST['contenu']);
fwrite($handle,$contenu) or die("ERROR WRITING $file");
fclose($handle);
echo "
Modifié avec succès
";
}
else {
$handle = fopen($file,"r") or die("CANT READ FILE $file");
$contenu = fread($handle,filesize($file)) or die("ERROR READING $file");
echo "
Message d'acceuil:
$contenu
";
}
}
elseif($chemin[2] == "modif_forum")
{
if ($chemin[3] == "creer")
{
if (
!empty($_POST['ref']) and
!empty($_POST['nom']) and
!empty($_POST['description']))
{
echo "Creation ...";
$query = "CREATE TABLE informatique.".$_POST['ref']." (
id int( 11 ) NOT NULL AUTO_INCREMENT ,
com_id int( 11 ) NOT NULL default '0',
topic_id int( 11 ) NOT NULL default '0',
date varchar( 19 ) NOT NULL default '',
pseudo varchar( 50 ) NOT NULL default '',
nom varchar( 100 ) NOT NULL default '',
contenu text NOT NULL ,
UNIQUE KEY id ( id )
) TYPE = MYISAM ;
";
mysql_query($query) or die($query." ".mysql_error());
echo "Creation OK";
$query = "INSERT INTO description (ref,nom,description,axx)
VALUES ('".$_POST['ref']."','".$_POST['nom']."','".$_POST['description']."','".$_POST['axx']."')";
mysql_query($query) or die(mysql_error()." $query");
}
else {
echo "
Ref
Nom
Nom
Axx pour vue
Action
";
}
}
elseif ($chemin[3] == "supprimer")
{
if (!empty($_POST['ref']))
{
if (ereg("^forum_",$_POST['ref']))
{
$query = "DROP TABLE ".$_POST['ref'];
mysql_query($query) or die(mysql_error());
$query = "DELETE FROM description WHERE ref='".$_POST['ref']."'";
mysql_query($query) or die(mysql_error());
echo "
Supprimé avec succès
";
}
else { echo "
Table pas du forum?
"; }
}
else {
echo "
AUCUNE SUPPRESSION EST REVERSIBLE ! IL N'Y A PAS DE BACKUP ! \n";
$query = "SELECT ref,nom FROM description";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "
".$row['nom']." => ".$row['ref']."
";
}
}
}
else {
echo "
";
}
}
elseif ($chemin[2] == "forum")
{
if (!empty($chemin[3]))
{
if ($_POST['nom'] and $_POST['ref'] and $_POST['description'])
{
$query = "UPDATE description SET nom='".$_POST['nom']."',description='".$_POST['description']."',ref='".$_POST['ref']."' WHERE id='$chemin[3]'";
mysql_query($query) or die(mysql_error());
echo "
";
}
else {
$chemin[3] = preg_replace("[^0-9]","",$chemin[3]);
echo "
Forum
";
$query = "SELECT id,ref,nom,description FROM description WHERE id='$chemin[3]'";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
echo "
";
}
echo "
";
}
}
else {
echo "
Tables existantes:
";
$query = "SELECT id,nom FROM description";
$result = mysql_query($query) or die(mysql_error());
echo "
";
while ($row = mysql_fetch_assoc($result))
{
echo "".$row["nom"]." \n";
}
echo " ";
}
}
else {
echo "
";
}
echo "
";