1 <?php 2 include("config.php"); 3 session_start(); 4 if(empty($_SESSION)){ 5 header("location: login.php"); 6 } 7 ?> 8 <html> 9 <body> 10 <?php 11 if(!isset($_SESSION["username"])){ 12 header("location: login.php"); 13 } 14 if(isset($_GET["intestazione"])){ 15 echo $_GET["intestazione"]; 16 if(isset($_POST["newpost"])){ 17 $intestazione=inputconvalid($_GET["intestazione"]); 18 $post=inputconvalid($_POST["newpost"]); 19 $link=$site."/topicdiscusso.php?intestazione=".$intestazione."; 20 $sql='INSERT INTO Posts VALUES ('".$intestazione."','".$post."','".$_SESSION["username"]."','".$link."')'; 21 $conn->query($sql); 22 } 23 } 24 $sql='SELECT Post,intestazione,username FROM Posts WHERE intestazione=='".$intestazione."''; 25 echo $sql; 26 $result = $conn->query($sql); 27 if($result->num_rows > 0){ 28 $i=0; 29 while($row = $result->fetch_assoc()) { 30 if($i=0){ 31 echo ' 32 <div> 33 <div> 34 <h1>".$row["intestazione"]."</h1> 35 </div> 36 <div> 37 <a align=\"left\">".$row["username"]."</a> 38 <a align=\"center\"><h1>".$row["post"]."</h1></a> 39 </div> 40 </div> 41 ' ; 42 }else{ 43 echo ' 44 <div> 45 <a align=\"left\">".$row["username"]."</a> 46 <a align=\"center\"><h1>".$row["post"]."</h1></a> 47 </div> 48 '; 49 } 50 $i++; 51 } 52 }?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)