Deze code wordt gebruikt om comments te laten zien bij een nieuwsbericht en er ook 1 te posten. als je ingelogd bent en er een post wordt r18-r24 uitgevoerd en normaal doet ie dan ook nog r31-r35 vanaf r32 stopt de script. Weet er iemand hoe dat dat komt?
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
| function getcomment($id){ $id=addslashes($id); $sql = mysql_fetch_assoc(mysql_query("Select * from site_news WHERE id = '".$id."'")) or die('comments error'); temp($sql,$temp); if (loggedin()){ if(!isset($_POST['submit'])){ if(isset($_POST['preview'])){ echo '<table width="440" border="0" cellspacing="0" cellpadding="0" class=contentnews><tr> <td width="2" rowspan="3" bgcolor="#F7941D"></td><td height="2" bgcolor="#F7941D"></td> <td width="2" rowspan="3" bgcolor="#F7941D"></td></tr><tr><td>'.$_POST['tekst'].'</td></tr><tr> <td height="2" bgcolor="#F7941D"></td></tr></table>'; } $comment = array("nid" => $id, "tekst" => $_POST['tekst']); temp($comment, "templates/cominput.html"); } else { $tekst = addslashes($_POST['tekst']); $ids = mysql_fetch_assoc(mysql_query("Select id FROM site_comments ORDER by 'id' DESC Limit 0,1")); $id = $ids['id'] + 1; $tijd = tijd(); $nid = addslashes($_POST['nid']); mysql_query("INSERT INTO `site_comments` ( `id` , `author` , `authorid` , `nid` , `comment` , `date` ) VALUES ('".$id."', '".$_SESSION['username']."', '".$_SESSION['uid']."', '".$nid."', '".$tekst."', '".$tijd."');"); } } else { echo"<center><font color=red>U need to be logged in to post a comment</font></center>"; } temp($fces, "templates/commentheader.html"); $com = mysql_query("SELECT * FROM `site_comments` WHERE `nid` = '".$id."' ORDER BY 'id' DESC"); while ($don = mysql_fetch_assoc($com)){ temp($don, "templates/comment.html");} temp($fces, "templates/commentfooter.html"); } |