Old stuff/old_sites/www/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=\"index.php?page=forum&id=/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 $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 $chemin[2] (topic_id,com_id,nom,pseudo,date,contenu) VALUES('$topic_id','1','$nom','$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=\"index.php?page=forum&id=/site/forum/$chemin[2]\" title=\"retour\">Retour</a> :: <a href=\"index.php?page=forum&id=/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 à $4:$5:$6",$date);
echo "<p>Nouvel element: $chemin[2]</p>";
echo "
<form action=\"index.php?page=forum&id=/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";
}
}
}
?>