Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/newepik/include/modif.php

(Deskargatu)
<div class="article">
<h2>Modification</h2>
<div class="element">


<?
if ($axx<=5 ) { 
    echo "<p>Vous n avez pas la permission</p></div></div>";
}

else {
    $action=$chemin[4];
    $test = explode("-",$chemin[2]);
    $chemin[2] = preg_replace("[^0-9]","",$test[0]);
    $test = explode("-",$chemin[3]);
    $chemin[3] = $test[0];
    
    
    if (strcmp($action,"supp")==0)    
	{  $query = "DELETE FROM ".$chemin[2]." WHERE id=".$chemin[3]." LIMIT 1";
	mysql_query($query) or die("FATAL".mysql_error()."<br>".$query);
	$chemin[2]  = substr($chemin[2],0,3);
	 echo "<h2>Suppresion d'un element</h2><div><p class=\"underline\">Supprime avec succes</p>
	 <p>Code de l' article supprim&eacute; : $chemin[3]</p>
	 <p><a href=\"/site/$chemin[2]/$chemin[3]\">Retour</a></p>
	 </div>"; 
	}
    elseif (strcmp($action,"supprimer")==0)    { 
        echo "<p>Etes-vous sur de vouloir supprimer cet element?</p>
	<p class=\"important\"><a href=\"/site/modif/$chemin[2]/$chemin[3]/supp\">Supprimer l' element  !!</a></p>
	<p><a href=\"/site/\">Retour</a></p>
	"; 
	}
elseif(strcmp($action,"rmodif")==0)    { 	
	$art = $chemin[2];
	$type=$_POST['type'];
	$titre=text2html($_POST['titre']);
	$contenu =$_POST['contenu'];
	$query = "UPDATE $art SET arttyp='$type',titre='$titre',article='".text2html($contenu)."', modif=CONCAT(modif,' $nick') WHERE id='".$chemin[3]."'";
	mysql_query($query) or die("FATAL: ".mysql_error()."<br>$query");
	echo "<h2>Modification</h2>
	<div><p class=\"underline\">Modification effectuee</p>
	<p>article: $art</p>
	<p>Titre: $titre</p>
	</div>
	";
	}
	
elseif(strcmp($action,"modifier")==0)    { 
$query = "SELECT * from ".$chemin[2]." WHERE id='".$chemin[3]."'";
$result = mysql_query($query) or die("FATAL".mysql_error());
while($row = mysql_fetch_array($result))
{
$row[5] = preg_replace("/<a href=\"(.+?)\">(.+?)<\/a>/","[$1|$2]",$row[5]);
$row[5] = preg_replace("/<img alt=\"Image sans description\"  src=\"(.+?)\" \/>/","[img=$1]",$row[5]);
echo "<h2>modification de la table ".$chemin[2]."</h2><h3>Element poste par $row[2]</h3>

<div>
<p>modification successives par: $row[6]</p>
<form action=\"/site/$page/$chemin[2]/$chemin[3]/rmodif\" method=\"post\">
<p><input type=\"text\" name=\"type\" value=\"$row[3]\" /></p>
<p><input type=\"text\" name=\"titre\" value=\"$row[4]\" /></p>
<p><textarea rows=\"10\" cols=\"57\" name=\"contenu\">$row[5]</textarea></p>
<p><input class=\"button\" type=\"submit\" value=\"Valider\" /></p>
</div>
";
}



}
else  { echo "<p>choix inconnu:$action</p>"; }
echo "</div></div>"; 
}
?>