2019-12-27 01:57:39 +01:00
< ? php
//Cette page permet d'ajouter un sujet
include ( 'config.php' );
include_once 'mail.php' ;
if ( isset ( $_GET [ 'parent' ]))
{
$id = intval ( $_GET [ 'parent' ]);
if ( isset ( $_SESSION [ 'username' ]))
{
$dn1 = mysql_fetch_array ( mysql_query ( 'select count(c.id) as nb1, c.name from categories as c where c.id="' . $id . '"' ));
if ( $dn1 [ 'nb1' ] > 0 )
{
?>
<! DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< html xmlns = " http://www.w3.org/1999/xhtml " >
< head >
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " />
< link href = " <?php echo $design ; ?>/style.css " rel = " stylesheet " title = " Style " />
< link rel = " stylesheet " type = " text/css " href = " stylesheet.css " />
< script src = " jquery.js " ></ script >
< script src = " menus.js " ></ script >
< link rel = " shortcut icon " type = " image/x-icon " href = " Images/favicon_ie.ico " >
< title > Festiv ' Algo - Nouveau Sujet </ title >
< script type = " text/javascript " src = " functions.js " ></ script >
</ head >
< body >
< div id = " content " >
< ? php include ( " menu.php " ); ?>
< div class = " content " >
< ? php
$nb_new_pm = mysql_fetch_array ( mysql_query ( 'select count(*) as nb_new_pm from pm where ((user1="' . $_SESSION [ 'userid' ] . '" and user1read="no") or (user2="' . $_SESSION [ 'userid' ] . '" and user2read="no")) and id2="1"' ));
$nb_new_pm = $nb_new_pm [ 'nb_new_pm' ];
?>
< div class = " box " >
< div class = " box_left " >
< a href = " <?php echo $url_home ; ?> " > Index du forum </ a > & gt ; < a href = " list_topics.php?parent=<?php echo $id ; ?> " >< ? php echo htmlentities ( $dn1 [ 'name' ], ENT_QUOTES , 'UTF-8' ); ?> </a> > Nouveau Sujet
</ div >
< div class = " box_right " >
< a href = " list_pm.php " > Vos messages ( < ? php echo $nb_new_pm ; ?> )</a> - <a href="login.php">Déconnexion</a>
</ div >
< div class = " clean " ></ div >
</ div >
< ? php
if ( isset ( $_POST [ 'message' ], $_POST [ 'title' ]) and $_POST [ 'message' ] != '' and $_POST [ 'title' ] != '' )
{
include ( 'bbcode_function.php' );
$title = $_POST [ 'title' ];
$message = $_POST [ 'message' ];
if ( get_magic_quotes_gpc ())
{
$title = stripslashes ( $title );
$message = stripslashes ( $message );
}
$title = mysql_real_escape_string ( $title );
$message = mysql_real_escape_string ( bbcode_to_html ( $message ));
$time1 = time ();
if ( mysql_query ( 'insert into topics (parent, id, id2, title, message, authorid, timestamp, timestamp2) select "' . $id . '", ifnull(max(id), 0)+1, "1", "' . $title . '", "' . $message . '", "' . $_SESSION [ 'userid' ] . '", "' . $time1 . '", "' . time () . '" from topics' ))
{
$req = mysql_fetch_array ( mysql_query ( 'select username from users where id = ' . $_SESSION [ 'userid' ]));
$req2 = mysql_fetch_array ( mysql_query ( 'select id from topics where timestamp = ' . $time1 ));
$message = "
Un nouveau topic a été créé sur le forum : \ " " . $_POST [ 'title' ] . " \" de " . $req [ 'username' ] . " .<br /><br /><i> "
. $_POST [ 'message' ] . " </i><br /><br />
2019-12-27 02:42:56 +01:00
< center >< b >< a href = '".$base_url."/read_topic.php?id=".$req2[' id ']."' >>>> lien <<<</ a ></ b ></ center >
2019-12-27 01:57:39 +01:00
" ;
send_mail ( " bruno-godefroy@sfr.fr " , " Nouveau topic sur Festiv'Algo " , $message );
?>
< div class = " message " > Le sujet a bien & eacute ; t & eacute ; créé .< br />
< a href = " list_topics.php?parent=<?php echo $id ; ?> " > Retourner au forum </ a ></ div >
< ? php
}
else
{
echo 'Une erreur s\'est produite lors de la création du sujet.' ;
}
}
else
{
?>
< form action = " new_topic.php?parent=<?php echo $id ; ?> " method = " post " >
< label style = " width: 60px; " for = " title " > Titre </ label >< input type = " text " name = " title " id = " title " />< br />< br />
< div class = " message_buttons " >
< input type = " button " value = " Gras " onclick = " javascript:insert('[b]', '[/b]', 'message'); " /><!--
-->< input type = " button " value = " Italique " onclick = " javascript:insert('[i]', '[/i]', 'message'); " /><!--
-->< input type = " button " value = " Souligne " onclick = " javascript:insert('[u]', '[/u]', 'message'); " /><!--
-->< input type = " button " value = " Image " onclick = " javascript:insert('[img]', '[/img]', 'message'); " /><!--
-->< input type = " button " value = " Lien " onclick = " javascript:insert('[url]', '[/url]', 'message'); " /><!--
-->< input type = " button " value = " Gauche " onclick = " javascript:insert('[left]', '[/left]', 'message'); " /><!--
-->< input type = " button " value = " Centre " onclick = " javascript:insert('[center]', '[/center]', 'message'); " /><!--
-->< input type = " button " value = " Droite " onclick = " javascript:insert('[right]', '[/right]', 'message'); " />
</ div >
< textarea name = " message " id = " message " cols = " 70 " rows = " 6 " style = " resize: none; " ></ textarea >< br />
< input type = " submit " value = " Envoyer " />
</ form >
< ? php
}
?>
</ div >
</ div >
</ body >
< ? php include ( " bas_de_page.php " ); ?>
</ html >
< ? php
}
else
{
echo '<h2>La catégorie dans laquelle vous désirez ajouter un sujet n\'existe pas.</h2>' ;
}
}
}
else
{
echo '<h2>L\'identifiant dans laquelle vous désirez ajouter un sujet n\'est pas défini.</h2>' ;
}
?>