Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/newepik/include/inc_forum/edit.php

(Deskargatu)
</h3>
<?
$action = $_POST["action"] or $action="";
$nom = $_POST["nom"];
$contenu = $_POST["contenu"];
$chemin[4] = preg_replace("[^0-9]","",$chemin[4]);



if (!$axx) {die("Not logged") ; }
$query = "SELECT pseudo,nom,contenu FROM forum_$chemin[2] WHERE topic_id='$chemin[3]' and com_id='$chemin[4]'";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
    if ($nick != $row["pseudo"] and $axx < 5) { die("Non autorise"); }



if (($chemin[5]  == "Supprimer" or $chemin[5] == "Editer")and $action == "Supprimer")
{
    $query2 = "DELETE FROM forum_$chemin[2] WHERE topic_id='$chemin[3]' and com_id='$chemin[4]' LIMIT 1";
    $result2 = mysql_query($query2) or die("$query2<br>".mysql_error());
    echo "<p>Message Supprime avec Succes</p>
	  <p><a href=\"/site/forum/$chemin[2]/$chemin[3]-1\">Retour</a></p>";
    
}
elseif ($chemin[5] == "Editer" and $action == "Editer" and !empty($nom) and !empty($contenu))
{
    $query2 = "UPDATE forum_$chemin[2] SET nom='".text2html($nom)."',contenu='".text2html($contenu)."' WHERE topic_id='$chemin[3]' and com_id='$chemin[4]' LIMIT 1     ";
    $result2 = mysql_query($query2) or die("$query2<br>".mysql_error());
    echo "<p>Message Edite avec succes!</p>
	<p><a href=\"/site/forum/$chemin[2]/$chemin[3]-1\">Retour</a></p>";
}
elseif($chemin[5] == "Supprimer")
{
    echo "<p>VOULEZ VOUS VRAIMENT SUPPRIMER CE MESSAGE?</p>";
    echo "<form action=\"/site/forum/$chemin[2]/$chemin[3]/$chemin[4]/Editer\" method=\"post\">
	    <p><input type=\"submit\" name=\"action\" value=\"Supprimer\" /></p></dd>
	</form>
	<p><a href=\"/site/forum/$chemin[2]/$chemin[3]-1\">Retour</a></p>
	";
}


else
 {
    aide();
    echo "
    <form action=\"/site/forum/$chemin[2]/$chemin[3]/$chemin[4]/Editer\" method=\"post\">
	<dl>
	<dt>Nom:</dt><dd><input type=\"text\" name=\"nom\" value=\"".$row["nom"]."\" /></dd>
	<dt>Message</dt><dd><textarea name=\"contenu\" rows=\"15\" cols=\"50\">".preg_replace("/<a href=\"(.+?)\">(.+?)<\/a>/","[$1|$2]",$row["contenu"])."</textarea></dd>
	<dd><input type=\"submit\" name=\"action\" value=\"Editer\" /> ::  
	    <input type=\"submit\" name=\"action\" value=\"Supprimer\" /></dd>
	</dl>
	</form>
	";




}

}




?>