* Frame script for user management *

* Access restricted to administrators and members of group "Management" * @author Gabriele Droege, DNA Bank Network * @version 2.0 * @package Configuration * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ /** * calling connection to database */ include ("../config/head.php"); /** * calling authorisation script */ include ("../auth.php"); ?> DNA Module - User management

Configuration Tool
User Management

"; } } // if($formSubmitSave) ?> "; $UserCheck = "true";} else { echo ""; 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 ""; $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 ""; $UserCheck = "true"; } if(!$sql) { echo ""; $UserCheck = "true"; } } else { echo ""; $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 ""; 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 ''; } ?>
Changes not accepted!
Please select an user.

Please change group, login name or email for selected user.

"; foreach ($_POST['user'] as $index) { $ID_User = $_POST['formPeople'][$index]; $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 WHERE user.ID_User = '$ID_User'"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $sql); while($row = mysqli_fetch_object($result)) { echo ""; }} echo "
SignatureLogin NameEmailGroup
".$row->Signature.""; echo ""; echo "
Please select an user.
User successfully deleted.
User can't be deleted.
User ".$Signature." can't be deleted, since he/her has created records. You can change his/her group membership instead.

The following users are registered to the DNA Module:

"; $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 ""; } else { echo ""; } }} echo ""; echo "
SignatureLogin NameEmailGroupDNA entriesSpecimen entries
".$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 "
".$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 "
Choose action:
'; } else { echo 'value="Return to Configuration Tool" name="formSubmitMenu" id="SelectLong" onClick="self.location.href = \'configuration.php\';">'; } ?>