2005-09-10 19:25:43 +02:00
|
|
|
|
<?PHP
|
|
|
|
|
|
|
|
|
|
$title = "User-Liste";
|
|
|
|
|
$header = "Index";
|
2008-09-10 20:30:16 +02:00
|
|
|
|
include ("../../includes/header.php");
|
|
|
|
|
include ("../../includes/funktion_db_list.php");
|
|
|
|
|
include ("../../includes/crypt.php");
|
|
|
|
|
include ("../../includes/funktion_db.php");
|
2005-09-10 19:25:43 +02:00
|
|
|
|
|
2010-01-26 22:38:19 +01:00
|
|
|
|
if( !IsSet($_POST["enterUID"]) )
|
|
|
|
|
{
|
|
|
|
|
$Right = "N";
|
|
|
|
|
} elseif( $_POST["enterUID"] > 0 ) {
|
|
|
|
|
$Right = $_SESSION['CVS'][ "admin/user.php"];
|
|
|
|
|
} else {
|
|
|
|
|
$Right = $_SESSION['CVS'][ "admin/group.php"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ($Right=="Y") && IsSet($_GET["action"]))
|
2005-09-10 19:25:43 +02:00
|
|
|
|
{
|
|
|
|
|
SetHeaderGo2Back();
|
2005-11-06 17:33:22 +01:00
|
|
|
|
echo "Gesendeter Befehl: ". $_GET["action"]. "<br>";
|
2010-01-26 22:38:19 +01:00
|
|
|
|
|
2005-11-06 17:33:22 +01:00
|
|
|
|
switch ($_GET["action"])
|
|
|
|
|
{
|
2005-09-10 19:25:43 +02:00
|
|
|
|
case "change":
|
2005-11-06 17:33:22 +01:00
|
|
|
|
if (IsSet($_POST["enterUID"]))
|
2005-09-10 19:25:43 +02:00
|
|
|
|
{
|
2010-01-19 23:52:47 +01:00
|
|
|
|
if ($_POST["Type"] == "Secure")
|
2005-09-10 19:25:43 +02:00
|
|
|
|
{
|
|
|
|
|
$SQL2 = "UPDATE `UserCVS` SET ";
|
2006-12-04 20:54:51 +01:00
|
|
|
|
$SQL_CVS = "SELECT * FROM `UserCVS` WHERE `UID`='". $_POST["enterUID"]. "'";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$Erg_CVS = mysql_query($SQL_CVS, $con);
|
|
|
|
|
$CVS_Data = mysql_fetch_array($Erg_CVS);
|
|
|
|
|
$CVS_Data_i = 1;
|
|
|
|
|
foreach ($CVS_Data as $CVS_Data_Name => $CVS_Data_Value)
|
|
|
|
|
{
|
2010-01-13 00:07:42 +01:00
|
|
|
|
if( ($CVS_Data_i+1)%2 && $CVS_Data_Name!="UID") {
|
|
|
|
|
if( $CVS_Data_Name == "GroupID")
|
|
|
|
|
{
|
|
|
|
|
if( $_POST["enterUID"] > 0 )
|
2010-01-26 22:38:19 +01:00
|
|
|
|
$SQL2.= "`$CVS_Data_Name` = '". $_POST["GroupID"]."', ";
|
|
|
|
|
else
|
|
|
|
|
$SQL2.= "`$CVS_Data_Name` = NULL, ";
|
2010-01-13 00:07:42 +01:00
|
|
|
|
} else {
|
|
|
|
|
$SQL2.= "`$CVS_Data_Name` = '". $_POST[$CVS_Data_i]."', ";
|
|
|
|
|
}
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
2010-01-13 00:07:42 +01:00
|
|
|
|
$CVS_Data_i++;
|
|
|
|
|
}
|
2005-09-10 19:25:43 +02:00
|
|
|
|
$SQL2 = substr( $SQL2, 0, strlen($SQL2)-2 );
|
2006-12-04 20:54:51 +01:00
|
|
|
|
$SQL2.= " WHERE `UID`='". $_POST["enterUID"]. "' LIMIT 1;";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
echo "<br>Secure-";
|
2006-04-16 22:11:08 +02:00
|
|
|
|
$Erg = db_query($SQL2, "change user CVS");
|
|
|
|
|
if ($Erg == 1) {
|
|
|
|
|
echo "Änderung wurde gesichert...\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Fehler beim speichern...\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
2006-11-10 14:43:13 +01:00
|
|
|
|
else
|
2006-11-10 19:17:24 +01:00
|
|
|
|
echo "<h1>Fehler: Unbekanter Type (". $_POST["Type"]. ") <20>bergeben\n</h1>\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
2006-11-10 14:43:13 +01:00
|
|
|
|
else
|
2006-11-10 19:17:24 +01:00
|
|
|
|
echo "<h1>Fehler: UserID (enterUID) wurde nicht per POST <20>bergeben</h1>\n";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "delete":
|
2005-11-06 17:33:22 +01:00
|
|
|
|
if (IsSet($_POST["enterUID"]))
|
2005-09-10 19:25:43 +02:00
|
|
|
|
{
|
2005-11-06 17:33:22 +01:00
|
|
|
|
echo "delate User...";
|
2006-12-04 20:54:51 +01:00
|
|
|
|
$SQL="DELETE FROM `User` WHERE `UID`='". $_POST["enterUID"]. "' LIMIT 1;";
|
2006-04-16 22:11:08 +02:00
|
|
|
|
$Erg = db_query($SQL, "User delete");
|
|
|
|
|
if ($Erg == 1) {
|
|
|
|
|
echo "Änderung wurde gesichert...\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Fehler beim speichern...\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-06 17:33:22 +01:00
|
|
|
|
echo "<br>\ndelate UserCVS...";
|
2006-12-04 20:54:51 +01:00
|
|
|
|
$SQL2="DELETE FROM `UserCVS` WHERE `UID`='". $_POST["enterUID"]. "' LIMIT 1;";
|
2006-04-16 22:11:08 +02:00
|
|
|
|
$Erg = db_query($SQL2, "User CVS delete");
|
|
|
|
|
if ($Erg == 1) {
|
|
|
|
|
echo "Änderung wurde gesichert...\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Fehler beim speichern...\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-06 17:33:22 +01:00
|
|
|
|
echo "<br>\ndelate UserEntry...";
|
2006-12-04 20:54:51 +01:00
|
|
|
|
$SQL3="UPDATE `ShiftEntry` SET `UID`='0', `Comment`=NULL ".
|
|
|
|
|
"WHERE `UID`='". $_POST["enterUID"]. "';";
|
2006-04-16 22:11:08 +02:00
|
|
|
|
$Erg = db_query($SQL3, "delate UserEntry");
|
|
|
|
|
if ($Erg == 1) {
|
|
|
|
|
echo "Änderung wurde gesichert...\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Fehler beim speichern...\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
} // end switch
|
|
|
|
|
|
|
|
|
|
// ende - Action ist gesetzt
|
2010-01-26 22:38:19 +01:00
|
|
|
|
} elseif ( IsSet($_GET["new"]) && ($_SESSION['CVS']["admin/group.php"]=="Y") ) {
|
|
|
|
|
echo "Gesendeter Befehl: ". $_GET["new"]. "<br>";
|
|
|
|
|
|
|
|
|
|
switch ($_GET["new"])
|
|
|
|
|
{
|
|
|
|
|
case "newGroup":
|
|
|
|
|
echo "\tGenerate new Group ID...\n";
|
|
|
|
|
$SQLid="SELECT MIN(`UID`) FROM `UserCVS`;";
|
|
|
|
|
$Erg = mysql_query( $SQLid);
|
|
|
|
|
|
|
|
|
|
if( mysql_num_rows($Erg) == 1) {
|
|
|
|
|
$NewId = mysql_result( $Erg, 0, 0)-1;
|
|
|
|
|
$SQLnew1 = "INSERT INTO `UserGroups` (`UID`, `Name`) VALUES ('$NewId', '". $_POST["GroupName"]. "' );";
|
|
|
|
|
$SQLnew2 = "INSERT INTO `UserCVS` (`UID`, `GroupID`) VALUES ('$NewId', NULL );";
|
|
|
|
|
echo "\t<br>Generate new UserGroup ...\n";
|
|
|
|
|
$ErgNew1 = db_query($SQLnew1, "create UserGroups Entry");
|
|
|
|
|
if ($ErgNew1 == 1)
|
|
|
|
|
{
|
|
|
|
|
echo "\t<br>Generate new User rights...\n";
|
|
|
|
|
$ErgNew2 = db_query($SQLnew2, "UserCVS Entry");
|
|
|
|
|
if ($ErgNew1 == 1) {
|
|
|
|
|
echo "\t<br>New group was created.\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo "Error on creation\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo "Error on creation\n(". mysql_error($con). ")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2005-09-10 19:25:43 +02:00
|
|
|
|
// kein Action gesetzt -> abbruch
|
2005-11-06 17:33:22 +01:00
|
|
|
|
echo "Unzulässiger Aufruf.<br>Bitte neu editieren...";
|
2005-09-10 19:25:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-09-10 20:30:16 +02:00
|
|
|
|
include ("../../includes/footer.php");
|
2005-09-10 19:25:43 +02:00
|
|
|
|
?>
|
|
|
|
|
|