Answer deleted!"; break; default: break; } echo "
"; $tbl_name="forum_question"; // Table name // Connect to server and select database. include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php"); @$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS); @$x = mysql_select_db($MYSQL_DATABASE); if (empty($x)) { die ("Keine Verbindung zur Datenbank! [FAIL]
"); } // get value of id that sent from address bar $id=mysql_real_escape_string($uebergabe2); $sql="SELECT * FROM $tbl_name WHERE id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); $settings = $rows; if (($_SESSION["user_admin"]=="1" && $rows["r_adminonly"] == "1") || $rows["r_guest"] == "1" || ($rows["r_adminonly"] == "0" &&(isset ($_SESSION["user_id"])))) { if($rows["like"] == "") { $rows["like"] = "0"; } if($rows["dislike"] == "") { $rows["dislike"] = "0"; } if(isset($_GET['success'])) { echo "
Answer successfully created!
"; } echo "
# Forum Home
# Forum Home
"; $sql = "SELECT Avatar FROM userdata WHERE Nickname = '".$rows["name"]."'"; $result = mysql_query ($sql); $Avatar=mysql_fetch_array ($result); echo"\n"; echo "
".$rows['topic']."
". $rows['detail'] ."
By:".$rows['name']." Date: ".$rows['datetime']." "; if(isset($_SESSION["user_id"])) { $sql = "SELECT * FROM forum_like WHERE question = '".$id."' AND answer = '0'"; $result = mysql_query ($sql); $liked = false; $disliked = false; while($Like=mysql_fetch_array($result)) { if($Like[2]==$_SESSION["user_nickname"]) { $liked = true; $disliked = true; } } if(!$liked) echo $rows['like'].""; else echo $rows['like'].""; if(!$disliked) echo $rows['dislike'].""; else echo $rows['dislike'].""; } else { echo $rows['like']."". $rows['dislike'].""; } echo "


"; $tbl_name2="forum_answer"; // Switch to table "forum_answer" $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id' ORDER BY a_id ASC"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)) { echo "
"; $sql = "SELECT Avatar FROM userdata WHERE Nickname = '".$rows["a_name"]."'"; $result = mysql_query ($sql); $Avatar=mysql_fetch_array ($result); if($rows["a_name"] == "") { $rows["a_name"] = "guest"; } if($rows["a_like"] == "") { $rows["a_like"] = "0"; } if($rows["a_dislike"] == "") { $rows["a_dislike"] = "0"; } echo" \n "; if($rows['a_attachment'] != "") { $pos1 = strpos($rows['a_attachment'], "-"); $pos2 = strpos($rows['a_attachment'], "-",$pos1+1); $attname = substr($rows['a_attachment'], $pos2+1); echo " "; } echo "
#". $rows['a_id']." , by:".$rows['a_name']; if(($_SESSION["user_nickname"] == $rows["a_name"] && $settings["closed"] != 1)|| $_SESSION["user_admin"]=="1") { echo "
"; echo "X"; echo "
"; } echo "
". $rows['a_answer']. "
Attachment: ".$attname."
Date: ".$rows['a_datetime']." "; if(isset($_SESSION["user_id"])) { $sql = "SELECT * FROM forum_like WHERE question = '".$id."' AND answer = '".$rows["a_id"]."'"; $result = mysql_query ($sql); $liked = false; $disliked = false; while($Like=mysql_fetch_array($result)) { if($Like[2]==$_SESSION["user_nickname"]) { $liked = true; $disliked = true; } } if(!$liked) echo $rows['a_like'].""; else echo $rows['a_like'].""; if(!$disliked) echo $rows['a_dislike'].""; else echo $rows['a_dislike'].""; } else { echo $rows['a_like']."". $rows['a_dislike'].""; } echo "

"; } $sql3="SELECT view FROM $tbl_name WHERE id='$id'"; $result3=mysql_query($sql3); $rows=mysql_fetch_array($result3); $view=$rows['view']; // if have no counter value set counter = 1 if(empty($view)) { $view=1; $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'"; $result4=mysql_query($sql4); } // count more value $addview=$view+1; $sql5="update $tbl_name set view='$addview' WHERE id='$id'"; $result5=mysql_query($sql5); mysql_close(); echo "

"; if (((isset ($_SESSION["user_id"]) && $settings["w_adminonly"]== "0") || $settings["w_guest"]=="1" || ($_SESSION["user_admin"]=="1"&&$settings["w_adminonly"]== "1")) && $settings["closed"] != "1") { echo"
"; if (isset ($_SESSION["user_id"])) { echo " "; } echo "
Answer :
Attachment :
 
"; } } ?>