-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransfert_addTopic.php
42 lines (27 loc) · 1.57 KB
/
transfert_addTopic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include_once("./db.php");
//Topic
if ($_POST["titre"]==""){
header("location: ./addTopic.php?id=".$_POST['idForum']."");
}else
{
$req_connexion=query("SELECT * FROM topic WHERE idTopic='".$_POST['idTopic']."'; ");
if(mysql_num_rows($req_connexion)==0)
{
query("INSERT INTO topic(nomTopic,dateTopic,id_Forum,id_Util)values('".$_POST['titre']."', '".$_SERVER['REQUEST_TIME']."','".$_POST['idforum']."','".$_POST['session']."')");
//MESSAGE
$topic_connexion=query("SELECT MAX( idTopic ) AS idTopic FROM topic");
$topic_find=mysql_fetch_array($topic_connexion);
$topic=$topic_find[0];
query("INSERT INTO message(contenuMsg,dateMsg,id_Topic,id_Util)VALUES('".($_POST['contenu'])."', '".date('l\t\h\e jS')."','".$topic."','".$_POST['session']."')");
$topic_connexion2=query("SELECT MAX( idTopic ) AS idTopic FROM topic");
$topic_find2=mysql_fetch_array($topic_connexion2);
$topic2=$topic_find2[0];
header("location: ./topic.php?id=".$topic2."");
}
else
{
echo"".$_POST['titre']."";echo"".$_POST['idforum']."";echo"".$_POST['session']."";
}
}
?>