OpenVPN_Management_GUI/Admin/Modules/Usermanagement/include/viewuser_index.php

96 lines
3.8 KiB
PHP
Raw Normal View History

2012-07-16 21:30:19 +02:00
<?php
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
@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"];
$search= mysql_real_escape_string($_POST["search"]);
if($sort== "") $sort = "DESC"; //$_GET["sort"];
if($by=="") $by = "Id"; //$_GET["by"];
?>
<!-- MAIN CONTENT BEGINN ################################################################################ -->
<form action="<?php echo $PHP_SELF; ?>" method="post">
<br>
<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=="IsAdmin") echo "selected";?> value="IsAdmin">IsAdmin</option>
<option <?php if($by=="VPNId") echo "selected";?> value="VPNId">VPNId</option>
<option <?php if($by=="Vorname") echo "selected";?> value="Vorname">First Name</option>
<option <?php if($by=="Nachname") echo "selected";?> value="Nachname">Last Name</option>
<option <?php if($by=="Nickname") echo "selected";?> value="Nickname">Nickname</option>
<option <?php if($by=="Email") echo "selected";?> value="Email">Email Address</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
// MYsql befehl basteln
$sql = "SELECT * FROM userdata WHERE Id LIKE '%".$search."%' OR VPNId LIKE '%".$search."%' OR Nickname LIKE '%".$search."%' OR Vorname LIKE '%".$search."%' ORDER BY $by $sort;";
$result = mysql_query($sql);
echo "<br><table border=1>";
if($by != "")
{
echo "<tr><td>ID</td><td>IsAdmin</td><td>VPNId</td><td>Nickname</td><td>Firstname</td><td>Lastname</td><td>Email Address</td>
<td>Novell Login</td><td>Edit</td><td>Delete</td>
</tr>\n";
}
// ------------------------------------------------ Mysql lesen
if ($result)
{
while ($ar=mysql_fetch_array($result,MYSQL_ASSOC))
{
echo "<tr><td>", $ar["Id"],
"</td><td>",$ar["IsAdmin"],
"</td><td>",$ar["VPNId"],
"</td><td>",$ar["Nickname"],
"</td><td>",$ar["Vorname"],
"</td><td>",$ar["Nachname"],
"</td><td>",$ar["Email"],
"</td><td>",$ar["NovLogin"],
"</td>",
"<form action=".$moduleurl."&uebergabe=2 method=post>",
"<input type=hidden name=nickname value=".$ar["Nickname"]." size=20><td>",
"<input type=submit value=X>",
"</form>",
"<form action=/Admin/Modules/Usermanagement/include/deleteuser.php method=post>",
"<input type=hidden name=path value=".$moduleurl." size=20>",
"<input type=hidden name=nickname value=".$ar["Nickname"]." size=20><td bgcolor=#FA5858>",
"<input type=submit value=X>",
"</form>",
"</tr>\n";
}
}
else
{
echo "<br>";
}
echo "</table>";
mysql_close();
?>
<p> <a href="<?php echo $moduleurl;?>"><b>Back</b></a></p>
<!-- END CONTENT BEGINN ################################################################################# -->
<?php
include("footer.php");
?>