OpenVPN_Management_GUI/Modules/Forum/delete_answer.php

45 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2012-07-16 21:30:19 +02:00
<?php
session_start();
include($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
$tbl_name="forum_question"; // Table name
$moduleurl = $_REQUEST["path"];
$topic = $_REQUEST["topic"];
$answer = $_REQUEST["answer"];
// 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! [<b><font color=red>FAIL</b></font>]<br>");
}
$tbl_name="forum_answer";
$sql = "SELECT a_name FROM $tbl_name WHERE question_id='".$topic."' AND a_id='".$answer."'";
$result = mysql_query ($sql);
$user=mysql_fetch_array ($result);
//die($user[0]);
if($_SESSION["user_nickname"] == $user[0] || $_SESSION["user_admin"] == "1")
{
$sql="DELETE FROM ". $tbl_name ." WHERE question_id='".$topic."' AND a_id='".$answer."'";
$result1=mysql_query($sql);
}
else
{
die("ERROR!!!");
}
if($result && $result1)
{
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic."&uebergabe3=1");
}
else
{
echo "ERROR";
}
mysql_close();
?>