Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/epik/include/inc_forum/new.php

(Deskargatu)
</h3>


<?
$chemin[3] = preg_replace("/^(\d+).*/","$1",$chemin[3]);
$date=date(Y)."-".date(m)."-".date(d)." ".date(H).":".date(i).":".date(s);
if (empty($axx)) { echo "<p>Vous devez etre identifies pour poster un nouvel element</p>\n"; }
else {
$nom = $_POST['nom'] or $nom = "";
$contenu = $_POST['contenu'] or $contenu = "";
$action = $_POST['action'] or $action = "";



if (empty($nom) or empty($contenu) or empty($nick))
{
    echo "<p>Nouvel element: $chemin[2]</p>";
    
    

    aide();
    echo "
    <form action=\"/site/forum/$chemin[2]/new\" method=\"post\">
    <dl>
    <dt>Titre: </dt><dd><input name=\"nom\" type=\"text\" value=\"$nom\" /></dd>
    <dt>Message:</dt><dd><textarea maxlength=\"30\" name=\"contenu\" rows=\"15\" cols=\"60\">$contenu</textarea></dd>
    <dt>Action</dt><dd><input name=\"action\" type=\"submit\" value=\"Visualiser\" /></dd>
		   <dd><input name=\"action\" type=\"submit\" value=\"Accepter\" /></dd>
    </dl>
    </form>
    ";
}    
else {    

    if ($action == "Accepter")
    {
	$query = "SELECT MAX(topic_id) from forum_$chemin[2]";
	$result = mysql_query($query) or die(mysql_error());
	while($row = mysql_fetch_array($result))
	{
	$topic_id = $row[0]+1;
	}
	echo "<p>Ajout du topic: $topic_id<p>";
	$query = "INSERT INTO forum_$chemin[2] (topic_id,com_id,nom,pseudo,date,contenu) VALUES('$topic_id','1','".text2html($nom)."','".text2html($nick)."','$date','".text2html($contenu)."')";
	mysql_query($query) or die(mysql_error()."<br>$query");
	echo "<dl>
	<dt>Pseudo:<dt><dd>$nick</dd>
	<dt>Titre</dt><dd>$nom</dd>
	<dt>Message</dt><dd>$contenu</dd>
	</dl>
	<p><a href=\"/site/forum/$chemin[2]\" title=\"retour\">Retour</a> :: <a href=\"/site/forum/$chemin[2]/$topic_id-".normalise($nom)."#bas\" title=\"$nom\">Visualier</a></a>";
    }
    elseif($action=="Visualiser")
     { 
    aide();
    $date = preg_replace("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$3/$2/$1 &agrave; $4:$5:$6",$date);
    echo "<p>Nouvel element: $chemin[2]</p>";
    echo "
    <form action=\"/site/forum/$chemin[2]/new\" method=\"post\">
    <dl>
    <dt>Titre: </dt><dd><input name=\"nom\" type=\"text\" value=\"$nom\" /></dd>
    <dt>Message:</dt><dd><textarea maxlength=\"30\" name=\"contenu\" rows=\"15\" cols=\"60\">$contenu</textarea></dd>
    <dt>Action</dt><dd><input name=\"action\" type=\"submit\" value=\"Visualiser\" /></dd>
		   <dd><input name=\"action\" type=\"submit\" value=\"Accepter\" /></dd>
    </dl>
    </form>
    
    <div class=\"foruma\">
    <dl><dt>$nom</dt><dd>par $nick le $date</dd></dl>
    <div>
    ";
    $row = explode("\n",$contenu);
    foreach($row as $key)  { echo "<p>$key</p>\n"; }
    echo "</div></div>\n";
     
     
     
     }
    
    
}    
    

}




?>