298 lines
8.8 KiB
PHP
Executable File
298 lines
8.8 KiB
PHP
Executable File
<?php
|
|
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
|
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
|
include($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
|
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/config.inc");
|
|
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/functions.inc");
|
|
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/openssl-functions.inc");
|
|
openssl_load_database ();
|
|
|
|
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
|
@$x = mysql_select_db($MYSQL_DATABASE);
|
|
if (empty($x))
|
|
{
|
|
echo "ERROR 0x01, Failed to connect to database!<br>";
|
|
exit;
|
|
}
|
|
$sort = mysql_real_escape_string($_POST["dirsort"]); //$_GET["sort"];
|
|
$by = mysql_real_escape_string($_POST["sortby"]); //$_GET["by"];
|
|
$userid = mysql_real_escape_string($_POST["userid"]); //$_GET["userid"];
|
|
$search = mysql_real_escape_string($_POST["search"]); //$_GET["search"];
|
|
|
|
$moduleurl = $_SERVER["REQUEST_URI"];
|
|
$urlcut = strpos($moduleurl, "&");
|
|
$moduleurl = substr($moduleurl,0,$urlcut);
|
|
?>
|
|
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
|
<h1><b>Squid Config</b></h1>
|
|
<?php
|
|
if(is_file("/var/run/squid.pid"))
|
|
{
|
|
echo "<b>Squid is currently: <font color=green>running</font></b><br />";
|
|
}
|
|
else
|
|
{
|
|
echo "<b>Squid is currently: <font color=red>stopped</font></b><br />";
|
|
}
|
|
|
|
if ($_REQUEST["uebergabe2"]=="3")
|
|
{
|
|
echo "<b>Squid restarted successfully!</b>";
|
|
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
|
}
|
|
if ($_REQUEST["uebergabe2"]=="4")
|
|
{
|
|
echo "<b>Squid started successfully!</b>";
|
|
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
|
}
|
|
if ($_REQUEST["uebergabe2"]=="5")
|
|
{
|
|
echo "<b>Squid stopped successfully!</b>";
|
|
echo "<meta http-equiv=\"Refresh\" content=\"3; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
|
}
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
<form action="/Admin/Modules/Squid/include/restartsquid.php" method="post" >
|
|
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>" />
|
|
<input type="submit" value="Restart Squid" />
|
|
</form>
|
|
</td>
|
|
<?php
|
|
if(!is_file("/var/run/squid.pid"))
|
|
{
|
|
echo "
|
|
<td>
|
|
<form action=\"/Admin/Modules/Squid/include/startsquid.php\" method=\"post\" >
|
|
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
|
<input type=\"submit\" value=\"Start Squid\" />
|
|
</form>
|
|
</td>";
|
|
}
|
|
?>
|
|
<?php
|
|
if(is_file("/var/run/squid.pid"))
|
|
{
|
|
echo "
|
|
<td>
|
|
<form action=\"/Admin/Modules/Squid/include/stopsquid.php\" method=\"post\" >
|
|
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
|
<input type=\"submit\" value=\"Stop Squid\" />
|
|
</form>
|
|
</td>";
|
|
}
|
|
?>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<h2>Change Proxy Account:</h2>
|
|
<?php
|
|
if ($_REQUEST["uebergabe2"]=="1")
|
|
{
|
|
echo "<b>Changed Squid Account successfully!</b>";
|
|
}
|
|
?>
|
|
<br>
|
|
<p>
|
|
<form action="/Admin/Modules/Squid/changesquid.php" method="post" >
|
|
Squid ID (HEX):
|
|
<input type="text" name="id" size="3">
|
|
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
|
<input type="submit" value="Change Squid User">
|
|
</form>
|
|
</p>
|
|
<p>
|
|
Current Squid User:
|
|
<?php
|
|
function dec_to_hex($dec)
|
|
{
|
|
$sign = ""; // suppress errors
|
|
if( $dec < 0){ $sign = "-"; $dec = abs($dec); }
|
|
|
|
$hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5,
|
|
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'A',
|
|
11 => 'B', 12 => 'C', 13 => 'D', 14 => 'E',
|
|
15 => 'F' );
|
|
|
|
do
|
|
{
|
|
$h = $hex[($dec%16)] . $h;
|
|
$dec /= 16;
|
|
}
|
|
while( $dec >= 1 );
|
|
|
|
return $sign . $h;
|
|
}
|
|
|
|
$zeile = exec(escapeshellcmd("cat ".db_getconfval("sqddir")."/vpnid"));
|
|
$zeile = dec_to_hex($zeile);
|
|
//echo $zeile;
|
|
if(strlen ($zeile) <2)
|
|
{
|
|
$zeile = "0".$zeile;
|
|
}
|
|
if(strlen ($zeile) >2)
|
|
{
|
|
$zeile=substr($zeile, 0, -1);
|
|
}
|
|
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
|
@$x = mysql_select_db($MYSQL_DATABASE);
|
|
if (empty($x))
|
|
{
|
|
echo "ERROR 0x01, Failed to connect to database!<br>";
|
|
exit;
|
|
}
|
|
$sql4 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
|
$result4 = mysql_query($sql4);
|
|
//echo $sql4;
|
|
$ar4=mysql_fetch_array($result4,MYSQL_ASSOC);
|
|
echo "<b>" . $ar4["Vorname"] . " " . $ar4["Nachname"] . "</b> VPNId: <b>" . $ar4["VPNId"]."</b>";
|
|
mysql_close();
|
|
?>
|
|
</p>
|
|
<br>
|
|
|
|
|
|
<h2>Blacklisted Accounts:</h2>
|
|
<?php
|
|
if ($_REQUEST["uebergabe2"]=="2")
|
|
{
|
|
echo "<b>Blacklist cleared successfully!</b>";
|
|
}
|
|
?>
|
|
<table border=1>
|
|
<tr><td><b>Squid ID</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td></tr>
|
|
<?php
|
|
$thisFileContent = file(db_getconfval("sqddir")."/blacklist");
|
|
//echo db_getconfval("sqddir")."/blacklist";
|
|
$blindex = 0;
|
|
foreach ($thisFileContent as $zeile)
|
|
{
|
|
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
|
@$x = mysql_select_db($MYSQL_DATABASE);
|
|
if (empty($x))
|
|
{
|
|
echo "ERROR 0x01, Failed to connect to database!<br>";
|
|
exit;
|
|
}
|
|
|
|
$hascontent = true;
|
|
if (strlen($zeile) >2)
|
|
{
|
|
$zeile=substr($zeile, 0, -1);
|
|
}
|
|
$sql3 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
|
$result3 = mysql_query($sql3);
|
|
$ar3=mysql_fetch_array($result3,MYSQL_ASSOC);
|
|
$nick = $ar3["Nickname"];
|
|
if($nick == "")
|
|
$hascontent=false;
|
|
$vor = $ar3["Vorname"];
|
|
if($vor == "")
|
|
$hascontent=false;
|
|
$nach = $ar3["Nachname"];
|
|
if($nach == "")
|
|
$hascontent=false;
|
|
|
|
if($hascontent == true)
|
|
{
|
|
$blindex = $blindex+1;
|
|
echo "<tr><td>".$zeile."</td><td>".$nick."</td><td>".$vor."</td><td>".$nach."</td></tr>";
|
|
}
|
|
mysql_close();
|
|
}
|
|
|
|
?>
|
|
</table>
|
|
<p> Blacklisted accounts:
|
|
<b>
|
|
<?php echo $blindex; ?></b> out of: <b>
|
|
<?php
|
|
if (count($openssl['Database']) == 0)
|
|
echo 'no certificates</b>';
|
|
elseif (count($openssl['Database'])-1 == 1)
|
|
{
|
|
echo '1</b> certificate';
|
|
}
|
|
elseif (count($openssl['Database'])-1 > 1)
|
|
{
|
|
echo '';
|
|
echo count($openssl['Database'])-1;
|
|
echo '</b> certificates';
|
|
}?>
|
|
</p>
|
|
<p>
|
|
<form action="/Admin/Modules/Squid/delbl.php" method="post" >
|
|
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
|
<input type="submit" value="Clear Blacklist">
|
|
</form>
|
|
</p>
|
|
<br>
|
|
|
|
<h2>User changed Proxy Accounts:</h2>
|
|
|
|
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
|
<select name="dirsort" size=1>
|
|
<option <?php if($sort=="ASC") echo "selected";?> value="ASC">Up</option>
|
|
<option <?php if($sort=="DESC") echo "selected";?> value="DESC">Down</option>
|
|
</select>
|
|
<select name="sortby" size=1>
|
|
<option <?php if($by=="Id") echo "selected";?> value="Id">ID</option>
|
|
<option <?php if($by=="VPNId") echo "selected";?> value="VPNId">VPNId</option>
|
|
<option <?php if($by=="Time") echo "selected";?> value="Time">Time</option>
|
|
<option <?php if($by=="IP") echo "selected";?> value="IP">IP</option>
|
|
<option <?php if($by=="Nickname") echo "selected";?> value="Nickname">Nickname</option>
|
|
</select>
|
|
Search User:<input type="text" name="search" size="20" <?php if($search !="") echo "value=".$search;?> ></td>
|
|
<input type="submit" value="go!">
|
|
</form>
|
|
|
|
<!------ Sorting Leiste Start-->
|
|
<?php
|
|
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
|
@$x = mysql_select_db($MYSQL_DATABASE);
|
|
if (empty($x))
|
|
{
|
|
echo "ERROR 0x01, Failed to connect to database!<br>";
|
|
exit;
|
|
}
|
|
// MYsql befehl basteln
|
|
|
|
|
|
if($by == "Nickname")
|
|
{
|
|
$sql = "SELECT * FROM proxyrepair;";
|
|
}
|
|
else
|
|
{
|
|
$sql = "SELECT * FROM proxyrepair ORDER BY $by $sort;";
|
|
}
|
|
|
|
$result = mysql_query($sql);
|
|
echo "<br><table border=1>";
|
|
echo "<tr><td><b>User ID</b></td><td><b>VPN Id</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td><td><b>Client IP</b></td><td><b>Time</b></td><td><b>Dead VPN ID</b></td></tr>\n";
|
|
// ------------------------------------------------ Mysql lesen
|
|
if ($result)
|
|
{
|
|
while ($ar=mysql_fetch_array($result,MYSQL_ASSOC))
|
|
{
|
|
|
|
$sql = "SELECT * FROM userdata WHERE Id = '".$ar["Id"]."' AND (Nickname LIKE '%".$search."%' OR Vorname LIKE '%".$search."%' OR Id LIKE '%".$search."%' OR VPNId LIKE '%".$search."%');";
|
|
$result2 = mysql_query($sql);
|
|
$ar2=mysql_fetch_array($result2,MYSQL_ASSOC);
|
|
|
|
if($ar2["Nickname"] != "")
|
|
echo "<tr><td>",$ar["Id"],"</td><td>",$ar["VPNId"],"</td><td>",$ar2["Nickname"],"</td><td>",$ar2["Vorname"],"</td><td>",$ar2["Nachname"],
|
|
"</td><td>", $ar["IP"],"</td><td>",$ar["Time"],"</td><td>",$ar["RepID"],"</td></tr>\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo "<br>";
|
|
}
|
|
echo "</table>";
|
|
mysql_close();
|
|
?>
|
|
|