VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
68
Modules/Forum/include/like.php
Executable file
68
Modules/Forum/include/like.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
|
||||
$tbl_name="forum_like"; // Table name
|
||||
// Connect to server and select database.
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
|
||||
$moduleurl = $_REQUEST['path'];
|
||||
@$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>");
|
||||
}
|
||||
|
||||
// get data that sent from form
|
||||
$topic=mysql_real_escape_string($_REQUEST['topic']);
|
||||
$answer=mysql_real_escape_string($_REQUEST['answer']);
|
||||
$user=mysql_real_escape_string($_REQUEST['user']);
|
||||
|
||||
$datetime=date("d/m/y H:i:s"); //create date time
|
||||
if($user != $_SESSION["user_nickname"])
|
||||
die("THIS IS NOT ALLOWED!");
|
||||
|
||||
if($topic != "")
|
||||
{
|
||||
if($answer=="0")
|
||||
{
|
||||
|
||||
$sql = "SELECT `like` FROM forum_question WHERE id = '".$topic."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_question SET `like`='".($like[0]+1)."' WHERE `id` = '".$topic."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT `a_like` FROM forum_answer WHERE `question_id` = '".$topic."' AND `a_id` = '".$answer."'";
|
||||
$result2 = mysql_query ($sql);
|
||||
$like=mysql_fetch_array ($result2);
|
||||
if($like[0] == "")
|
||||
$like[0] = 0;
|
||||
$sql="UPDATE forum_answer SET `a_like`='".($like[0]+1)."' WHERE `question_id`= '".$topic."' AND `a_id` = '".$answer."'";
|
||||
mysql_query($sql);
|
||||
}
|
||||
|
||||
$sql="INSERT INTO $tbl_name(`question`, `answer`, `nickname`, `datetime`, `like`)VALUES('$topic', '$answer', '$user', '$datetime', 'like')";
|
||||
//echo $sql;
|
||||
$result=mysql_query($sql);
|
||||
|
||||
if($result)
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ERROR";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header ("Location: ".$moduleurl."&uebergabe=1&uebergabe2=".$topic);
|
||||
}
|
||||
mysql_close();
|
||||
?>
|
Reference in New Issue
Block a user