" target="_blank"> |
Configuration Tool User Management |
|
|
Changes not accepted! | "; }
} // if($formSubmitSave)
?>
Please select an user. | ";
$UserCheck = "true";}
else
{
echo "Please change group, login name or email for selected user. | ";
echo " | "; }
}
/********************************************************************************************
* feature: "Change user settings" *
* END *
*********************************************************************************************/
/********************************************************************************************
* login as Administrator or memeber of Management group required *
* feature: "Delete user" *
* START *
*********************************************************************************************/
if($formSubmitChange and $formAction == "delete") {
if($_POST['user']=="")
{ unset($_POST['user']);
echo "Please select an user. | ";
$UserCheck = "true";}
else
{
foreach ($_POST['user'] as $index)
{
$ID_User = $_POST['formPeople'][$index];
$Signature = $_POST['formSignaturehidden'][$index];
$sqldna = "SELECT ID_DNA FROM dnabanknumbers WHERE Created_Who = '$Signature'";
$resultdna = mysqli_query($GLOBALS["___mysqli_ston"], $sqldna);
$countdna = mysqli_num_rows($resultdna);
$sqlspecimen = "SELECT ID_Collection FROM sptoolcollection WHERE Created_Who = '$Signature'";
$resultspecimen = mysqli_query($GLOBALS["___mysqli_ston"], $sqlspecimen);
$countspecimen = mysqli_num_rows($resultspecimen);
/********************************************************************************************
* check if user is creator of DNA or specimen records *
* user can only be deleted when he/she doesn't have created records *
*********************************************************************************************/
if($countdna == "0" and $countspecimen == "0") {
$sql = "DELETE FROM user WHERE ID_User = '$ID_User'";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if($sql) { echo "User successfully deleted. | ";
$UserCheck = "true"; }
if(!$sql) { echo "User can't be deleted. | ";
$UserCheck = "true"; }
}
else { echo "User ".$Signature." can't be deleted, since he/her has created records. You can change his/her group membership instead. | ";
$UserCheck = "true"; }}
}}
/********************************************************************************************
* feature: "Delete user" *
* END *
*********************************************************************************************/
/********************************************************************************************
* login as Administrator or memeber of Management group required *
* Start page, listing all registered user and number of created records *
* START *
*********************************************************************************************/
if(!$formSubmitChange or $formSubmitSave or $UserCheck == "true") {
$sqlcheck = "SELECT * from user where FK_Group = '1'";
$resultcheck = mysqli_query($GLOBALS["___mysqli_ston"], $sqlcheck);
$count = mysqli_num_rows($resultcheck);
if($count == 1) { while($rowcheck = mysqli_fetch_object($resultcheck)) {
$UserCheck = $rowcheck->ID_User; }}
$sql = "SELECT user.ID_User, user.Signature, user.Login, user.Email, usergroups.Group FROM user LEFT JOIN usergroups ON
user.FK_Group = usergroups.ID_Group ORDER BY usergroups.Group";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if($result) {
echo "The following users are registered to the DNA Module: | ";
echo " | Signature | Login Name | Email | Group | DNA entries | Specimen entries | ";
$gesamt = mysqli_num_rows($result);
for ($i=1; $i<=$gesamt; $i++) {
$row=mysqli_fetch_array($result);
{
$Signature = $row['Signature'];
$sqldna = "SELECT ID_DNA FROM dnabanknumbers WHERE Created_Who = '$Signature'";
$resultdna = mysqli_query($GLOBALS["___mysqli_ston"], $sqldna);
$countdna = mysqli_num_rows($resultdna);
$sqlspecimen = "SELECT ID_Collection FROM sptoolcollection WHERE Created_Who = '$Signature'";
$resultspecimen = mysqli_query($GLOBALS["___mysqli_ston"], $sqlspecimen);
$countspecimen = mysqli_num_rows($resultspecimen);
if($row['Signature'] == $log or $row['ID_User'] == $UserCheck)
{echo " | ".$row['Signature']." | ".$row['Login']." | ".$row['Email']." | ".$row['Group']." | ";
if($countdna > 0) { echo build_href2("../search/query.php","CrBy=$log",$countdna,"Show records"); }
else { echo $countdna; }
echo " | ";
if($countspecimen > 0) { echo build_href2("../sptool/query_sptool.php","CrBy=$log",$countspecimen,"Show records"); }
else { echo $countspecimen; }
echo " | "; }
else {
echo " | ".$row['Signature']." | ".$row['Login']." | ".$row['Email']." | ".$row['Group']." | ";
if($countdna > 0) { echo build_href2("../search/query.php","CrBy=".$row['Signature'],$countdna,"Show records"); }
else { echo $countdna; }
echo " | ";
if($countspecimen > 0) { echo build_href2("../sptool/query_sptool.php","CrBy=".$row['Signature'],$countspecimen,"Show records"); }
else { echo $countspecimen; }
echo " | "; }
}}
echo "Choose action: |
|
| ";
echo "
| ";
}
} // if(!$formSubmitChange)
/********************************************************************************************
* Start page *
* END *
*********************************************************************************************/
}
/**
* message permission denied for non administrators or managers
*/
if (!isset($_SESSION['admin']) && !$_SESSION['admin'] && !isset($_SESSION['management']) && !$_SESSION['management']) { echo '
| ';
include("../No_permission.php");
echo ' '; }
?>
|
'; }
else { echo 'value="Return to Configuration Tool" name="formSubmitMenu" id="SelectLong" onClick="self.location.href = \'configuration.php\';">'; } ?> |
|