OpenVPN_Management_GUI/Modules/UserControl/deadproxy.php

50 lines
1.2 KiB
PHP
Raw Normal View History

2012-07-16 21:30:19 +02:00
<?php
session_start();
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkuser.php");
include ($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
//include ("mysql.php");
//die ("UNAVAILABLE!");
// Aufbau der Datenbankverbindung
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
@$x = mysql_select_db($MYSQL_DATABASE);
if (empty($x))
{
die ("Could not connect to database!");
}
$vpnid = mysql_real_escape_string($_REQUEST["VPNId"]);
$id = mysql_real_escape_string($_REQUEST["Id"]);
$ip = mysql_real_escape_string($_REQUEST["IP"]);
$rep = mysql_real_escape_string($_REQUEST["RepID"]);
$moduleurl = $_REQUEST["path"];
$sql = "INSERT INTO ".
"proxyrepair (Id, VPNId, IP, RepID) ".
"VALUES ('".$id."', '".
$vpnid."', '".
$ip."', '".
$rep."')";
//echo $sql;
mysql_query ($sql);
if (mysql_affected_rows ($y) > 0)
{
// $myFile = db_getconfval("sqddir")."/vpnid_next";
$myFile = db_getconfval("sqddir")."/vpnid_auto";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "NEXT");
fclose($fh);
mysql_close();
header ("Location: ".$moduleurl."&uebergabe=0&uebergabe2=1");
}
else
{
mysql_close();
echo "Fehler beim Reparieren des Proxys.<br>\n";
}
?>