52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
|
<?php
|
||
|
session_start();
|
||
|
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||
|
|
||
|
require($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||
|
$ovpnkeydir = db_getconfval("ovpnkeydir");
|
||
|
|
||
|
// Aufbau der Datenbankverbindung
|
||
|
require($_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 ("Could not connect to database!");
|
||
|
}
|
||
|
|
||
|
// Definition der Benutzer
|
||
|
$benutzer["Nickname"] = mysql_real_escape_string($_REQUEST["nickname"]);
|
||
|
$moduleurl = $_REQUEST["path"];
|
||
|
|
||
|
// Get VPN id
|
||
|
|
||
|
$sql = "SELECT VPNId FROM userdata WHERE Nickname='".$benutzer["Nickname"]."'";
|
||
|
$result = mysql_query ($sql);
|
||
|
|
||
|
$benutzer["VPNId"] = mysql_fetch_array($result,MYSQL_ASSOC);
|
||
|
//echo $sql;
|
||
|
//echo $benutzer["VPNId"]["VPNId"];
|
||
|
|
||
|
//revoke certificate
|
||
|
chdir ("$ovpnkeydir");
|
||
|
exec(escapeshellcmd("./revoke " .$benutzer["VPNId"]["VPNId"]));
|
||
|
chdir ("/var/www/Admin/");
|
||
|
|
||
|
|
||
|
// Daten eintragen
|
||
|
// SQL-Anweisung erstellen
|
||
|
$sql = "DELETE FROM userdata WHERE Nickname = '" . $benutzer["Nickname"]."'";
|
||
|
mysql_query ($sql);
|
||
|
|
||
|
if (mysql_affected_rows ($y) > 0)
|
||
|
{
|
||
|
mysql_close();
|
||
|
header ("Location: ".$moduleurl."&uebergabe2=3");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
mysql_close();
|
||
|
echo "Fehler beim Loeschen des Benutzers.<br>\n";
|
||
|
}
|
||
|
?>
|