function CheckUpdateUser() { $UserValues = ['Username', 'Password', 'Name', 'Email', 'Phone', 'Role']; if (CheckList($UserValues)) { $usr = GetList($UserValues); UpdateUser($usr[0], $usr[1], $usr[2], $usr[3], $usr[4], $usr[5]); header('Location: Admin.php'); } }
function EditBranch() { $id = $_GET["EditBranch"]; if (preg_match('#^user:(.+)#', $id, $reg)) { return UpdateUser($reg[1]); } if (preg_match('#^group:([0-9]+)#', $id, $reg)) { return UpdateGroup($reg[1]); } }
function A() { try { addUser("wyq"); UpdateUser("sss"); } catch (Exception $e) { // echo $e->getLine(); throw $e; // echo $e->getMessage(); } }
DisplayUserList(); break; case 'disable': DisableUser($vars['id']); DisplayUserList(); break; case 'makeadmin': MakeAdminUser($vars['id']); DisplayUserList(); break; case 'notadmin': MakeNotAdminUser($vars['id']); DisplayUserList(); break; case 'update': UpdateUser($vars['id'], $vars['username'], $vars['password'], $vars['fullname'], $vars['email'], $vars['enabled'], $vars['isadmin'], $vars['isguest'], $vars['instanceid'], $vars['dataprojects'], $vars['phiprojects'], $vars['writedataprojects'], $vars['writephiprojects']); DisplayUserList(); break; case 'add': AddUser($vars['username'], $vars['password'], $vars['fullname'], $vars['email'], $vars['enabled'], $vars['isadmin'], $vars['isguest'], $vars['instanceid'], $vars['dataprojects'], $vars['phiprojects'], $vars['writedataprojects'], $vars['writephiprojects']); DisplayUserList(); break; case 'delete': DeleteUser($vars['id']); break; default: DisplayUserList(); } /* ------------------------------------ functions ------------------------------------ */ /* -------------------------------------------- */ /* ------- UpdateUser ------------------------- */
// Check for changes. foreach ($data as $key => $value) { if (!IsFieldInParamList($key, $param_list)) { continue; } if ($value != GetValueFromParamList($param_list, $key)) { $update = true; break; } } if ($update === false) { $success_msg = "No changes given."; goto GenerateHtml; } // Looks like we are okay to update database! $okay = UpdateUser($param_list, $userid); if ($okay === true) { $success_msg = "Data Updated!"; $data = GetUserInfo($userid); PopulateParamList($param_list, $data); } else { $error_msg = $okay; } } GenerateHtml: $picid = GetPicIDForUserID($userid); if ($picid > 0) { $picurl = PicUrl($picid, "thumb"); } $badgeid = $data["BadgeID"]; $havebadge = BadgeExists($badgeid);
//$ret->m = $captchaResponse['challenge_ts']." ".$captchaResponse['success']; print json_encode($ret); } if ($columns === "LOGIN") { $username = $_POST['username']; $password = $_POST['password']; print validateUser($username, $password); } if ($columns === "EDIT_PROFILE_RETRIEVE") { $ret["response"] = isLoggedIn(); $ret["data"] = getPublicUserData($_SESSION["user"]); print json_encode($ret); } if ($columns === "EDIT_PROFILE_SAVE") { $data = json_decode(stripslashes($_POST['data']), true); $ret = UpdateUser($data['email_id'], $data['password'], $data['first_name'], $data['middle_name'], $data['last_name'], $data['organization_id'], $data['authtype_id'], $data['securityquestion_id'], $data['securityquestion_ans'], $data['phone'], $data['country_name'], $data['country_code']); print $ret; } if ($columns === "LOGOUT") { logoutUser(); } if ($columns === "RESET_PASSWORD_PREP") { $username = $_POST['username']; print resetPassword_prep($username); } if ($columns === "RESET_PASSWORD_INIT") { $username = $_POST['username']; $securityanswer = $_POST['securityanswer']; $ret = new stdClass(); $ret = resetPassword_init($username, $securityanswer); $ret = json_decode($ret);
$SkinsArr = array(); $LangsArr = array(); $MenuSection = "admin"; $nsLang->TplInc("inc/user_welcome"); $ProgPath[0]['Name'] = $Lang['Administr']; $ProgPath[0]['Url'] = getURL("admin", "", "admin"); $ProgPath[1]['Name'] = ValidVar($EditUid) == $nsUser->UserId() ? $Lang['Profile'] : $Lang['Title']; $ProgPath[1]['Url'] = getURL("users", "", "admin"); ///////////////////////////////////////////// ///////// call any process functions if (!$nsUser->DEMO) { if (isset($EditArr) && is_array($EditArr) && isset($EditUid) && $EditUid == "new") { CreateUser($EditArr); } if (isset($EditArr) && is_array($EditArr) && isset($EditUid) && ValidId($EditUid)) { UpdateUser($EditUid, $EditArr); } if ($nsUser->ADMIN && isset($MakeUser) && ValidId($MakeUser)) { ConvertToUser($MakeUser); } if ($nsUser->ADMIN && isset($UnregisterUser) && ValidId($UnregisterUser)) { ConvertFromUser($UnregisterUser); } if (isset($DeleteUid) && ValidId($DeleteUid)) { DeleteUser($DeleteUid); } } ///////////////////////////////////////////// ///////// display section here $Query = "SELECT * FROM " . PFX . "_system_user SU"; $Sql = new Query($Query);
$description = ""; $email = ""; $pseudo = ""; $flagModification = 0; if (isset($_POST['valider'])) { if ($_POST['flagModification'] == 0) { if ($_POST['nom'] != null && $_POST['prenom'] != null && $_POST['dateNaissance'] != null && $_POST['description'] != null && $_POST['email'] != null && $_POST['pseudo'] != null && $_POST['pwd'] != null) { InsertUser($_POST['nom'], $_POST['prenom'], $_POST['dateNaissance'], $_POST['description'], $_POST['email'], $_POST['pseudo'], $_POST['pwd']); $message = "Formulaire envoyé !"; } else { $message = 'Veuillez renseigner tous les champs !'; } } else { if ($_POST['flagModification'] == 1) { if ($_POST['nom'] != null && $_POST['prenom'] != null && $_POST['dateNaissance'] != null && $_POST['description'] != null && $_POST['email'] != null && $_POST['pseudo'] != null) { UpdateUser($_POST['nom'], $_POST['prenom'], $_POST['dateNaissance'], $_POST['description'], $_POST['email'], $_POST['pseudo'], $_POST['pwd'], $_GET['id']); $message = 'Informations mises à jour !'; } else { $message = 'Veuillez renseigner tous les champs obligatoires !'; } } } } if (isset($_GET['id'])) { $valueModif = GetUsersById($_GET['id']); $nom = $valueModif[0]["nom"]; $prenom = $valueModif[0]["prenom"]; $dateNaissance = $valueModif[0]["dateNaissance"]; $description = $valueModif[0]["description"]; $email = $valueModif[0]["email"]; $pseudo = $valueModif[0]["pseudo"];
$i = strpos($value, "ID("); $email.= "i=$i.\n"; $j = strpos($value, ")", $i); $email.= "j=$j.\n"; $str = substr($value, $i + 3, $j - ($i + 3)); $email.= "str=$str.\n"; $unid = explode(':', $str); $email.= "unid=" . print_r($unid, true) . ".\n"; $uid = $unid[0]; $uname = $unid[1]; $email.= "uid=$uid.\n"; $email.= "uname=$uname.\n"; mysql_query("INSERT INTO donations SET date='{$p->ipn_data[payment_date]}', amount='$p->ipn_data[payment_gross]',uid='$uid',details='" . (addslashes(serialize($_POST))) . "'"); if ($p->ipn_data['payment_gross'] >= 1 AND !$isall) { UpdateUser($uid, "supporter=supporter+1,exp=exp+500"); } elseif ($p->ipn_data['payment_gross'] >= 1 AND $isall) { $all = "UPDATE alliances SET donated=donated+" . floatval($p->ipn_data['payment_gross']) . " WHERE id=$uid"; $email.= $all . "\n"; @mysql_query($all); } $s = ''; $vs = array(); $ks = array(); foreach ($p->ipn_data as $key => $value) { //$s .= "\n$key= \"$value\""; $ks[] = $key; $vs[] = "\"" . addslashes($value) . "\""; } $sales = "INSERT INTO sales SET (" . implode(',', $ks) . ") VALUES(" . implode(',', $vs) . ")"; $email.= $sales;
continue; } // query LDAP for the full user info $userInfo = $adldap->user_info($adUser, $ldapAttributes); if (NewUser($adUser, $oemrUsers)) { // add new user echo "Adding user {$adUser}"; if (AddUser($adUser, $userInfo)) { echo ", OK\n"; } else { echo ", FAILED\n"; } } else { // update existing users with Active Directory info echo "existing user {$adUser}"; if (UpdateUser($adUser, $userInfo)) { echo ", OK\n"; } else { echo ", FAILED\n"; } } } // re-query in case we have updated a username in the previous loop $oemrUsers = array(); $sqlH = sqlStatement("select id, username from users"); while ($onerow = sqlFetchArray($sqlH)) { array_push($oemrUsers, $onerow); } // for all the usernames in OpenEMR and NOT IN Active Directory // de-activate them in OpenEMR foreach ($oemrUsers as $user) {
echo "</script>"; } } } function Back() { echo "<script>"; echo "window.location = 'Admin.php';"; echo "</script>"; } if (isset($_POST['submitEC'])) { UpdateError(); } if (isset($_POST['submitKC'])) { UpdateKey(); } if (isset($_POST['submitUC'])) { UpdateUser(); } if (isset($_POST['submitk'])) { AddKey(); } if (isset($_POST['submitu'])) { AddUser(); } if (isset($_POST['cancel'])) { Back(); } ?>
function working($dd) { //echo "stringstringstringstringstringstringstringstring"; //var_dump($dd); $total = json_decode($dd, 1); if ($total['order'] == 'Insert') { if ($total['type'] == 'TEACHER') { ////////// AddTEACHER($total['data']); } else { if ($total['type'] == 'CLASS') { /////////////// AddCLASS($total['data']); } else { if ($total['type'] == 'IN') { AddIN($total['data']); } else { if ($total['type'] == 'OUT') { AddOUT($total['data']); } else { if ($total['type'] == 'USER') { /////////////////// AddUSER($total['data']); } else { if ($total['type'] == 'ROLE') { /////////////// AddRole($total['data']); } else { if ($total['type'] == 'SUP') { AddSupplier($total['data']); } else { if ($total['type'] == 'CUS') { AddCustomer($total['data']); } else { if ($total['type'] == 'CAT') { AddCategory($total['data']); } else { if ($total['type'] == 'UNIT') { AddUnit($total['data']); } else { if ($total['type'] == 'SKU') { AddSKU($total['data']); } else { if ($total['type'] == 'DEPT') { AddDepartment($total['data']); } else { if ($total['type'] == 'TRANSFER') { AddTRANSFER($total['data']); } else { echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>"; } } } } } } } } } } } } } } else { if ($total['order'] == 'Fetch') { if ($total['type'] == 'PRICE') { FetchPrice($total['data']); } else { if ($total['type'] == 'INV') { FetchItemINV($total['data']); } else { if ($total['type'] == 'WH') { FetchItemWH($total['data']); } else { if ($total['type'] == 'USER') { FetchItemUser($total['data']); } else { if ($total['type'] == 'STOCK') { //var_dump($total['data']); FetchStock($total['data']); } else { if ($total['type'] == 'SUP') { ItemSupplier($total['data']); } else { echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>"; } } } } } } } else { if ($total['order'] == 'Delete') { if ($total['type'] == 'INV') { DeleteINV($total['data']); } else { if ($total['type'] == 'WH') { DeleteWH($total['data']); } else { if ($total['type'] == 'USER') { DeleteUser($total['data']); } else { echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>"; } } } } else { if ($total['order'] == 'Update') { if ($total['type'] == 'INV') { UpdateINV($total['data']); } else { if ($total['type'] == 'WH') { UpdateWH($total['data']); } else { if ($total['type'] == 'USER') { UpdateUser($total['data']); } else { echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>"; } } } } else { if ($total['order'] == 'FetchAllNames') { if ($total['type'] == 'ROLE') { /////////////////// FetchAllNamesROLE(); } if ($total['type'] == 'CAT') { FetchAllNamesCAT(); } if ($total['type'] == 'UNIT') { FetchAllNamesUNIT(); } if ($total['type'] == 'PACk') { FetchAllNamesPACK(); } if ($total['type'] == 'INV_TYPE') { FetchAllNamesINV_TYPE(); } if ($total['type'] == 'CUS') { FetchAllNamesCUS(); } if ($total['type'] == 'SUP') { FetchAllNamesSUP(); } if ($total['type'] == 'DEPT') { FetchAllNamesDEPT(); } } else { if ($total['order'] == 'FetchAllIds') { if ($total['type'] == 'ROLE') { //////////////////// FetchAllIdsROLE(); } if ($total['type'] == 'RM') { FetchAllIdsRM(); } if ($total['type'] == 'INV') { FetchAllIdsINV(); } if ($total['type'] == 'INV_TYPE') { FetchAllIdsInvType(); } if ($total['type'] == 'PACK') { FetchAllIdsPACK(); } if ($total['type'] == 'SUP') { FetchAllIdsSUP(); } if ($total['type'] == 'CUS') { FetchAllIdsCUS(); } if ($total['type'] == 'DEPT') { FetchAllIdsDEPT(); } } else { if ($total['order'] == 'FetchAllAdmins') { FetchAllAdmins(); } else { if ($total['order'] == 'List') { if ($total['type'] == 'INV') { ListINV(); } else { if ($total['type'] == 'USER') { ListUser(); } else { if ($total['type'] == 'STOCK') { ListStock(); } else { if ($total['type'] == 'WH') { ListWH(); } else { if ($total['type'] == 'INV_WH') { ListINV_WH($total['data']); } else { if ($total['type'] == 'WH_INV') { ListWH_INV($total['data']); } else { if ($total['type'] == 'SUP') { ListSUP($total['data']); } else { if ($total['type'] == 'INV_SUP') { ListINV_SUP($total['data']); } else { if ($total['type'] == 'SUP_INV') { ListSUP_INV($total['data']); } else { if ($total['type'] == 'BINS') { ListBINS($total['data']); } } } } } } } } } } } else { if ($total['order'] == 'Value') { if ($total['type'] == 'WH') { ValueWH($total['data']); } else { if ($total['type'] == 'INV') { ValueINV($total['data']); } } } else { if ($total['order'] == 'Test') { if ($total['type'] == 'DATE') { TestDate(); } else { if ($total['type'] == 'BIN') { BinMap($total['data']); } else { if ($total['type'] == 'ItemLevel') { ItemLevel($total['data']); } } } } else { if ($total['order'] == 'FetchId') { if ($total['type'] == 'WH') { FetchIDWH($total['data']); } if ($total['type'] == 'CAT') { FetchIDCAT($total['data']); } if ($total['type'] == 'UNIT') { FetchIDUNIT($total['data']); } if ($total['type'] == 'ROLE') { /////////////////// FetchIDROLE($total['data']); } if ($total['type'] == 'INV_TYPE') { FetchIDINV_TYPE($total['data']); } if ($total['type'] == 'SUP') { FetchIDSUP($total['data']); } if ($total['type'] == 'PACK') { FetchIDPACK($total['data']); } if ($total['type'] == 'CUS') { FetchIDCUS($total['data']); } if ($total['type'] == 'DEPT') { FetchIDDEPT($total['data']); } } elseif ($total['order'] == 'login') { $recivedArray = $total['data']; //echo "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"; login($recivedArray['username'], $recivedArray['password']); } else { if ($total['order'] == 'logout') { //echo "Logout"; logout1(); } else { if ($total['order'] == 'authenticate') { authenticate(); } else { //Not Logged In Case OR Not Have required Privliges{ response("OK", 'fail', array('alertBox' => "Please Login First !")); } } } } } } } } } } } } } }
session_start(); $temp = $_POST["param"]; $temp = str_replace("[", "", $temp); $temp = str_replace("]", "", $temp); //echo $temp; $param = json_decode($temp); $ordr = (int) $param->order; switch ($ordr) { case 1: GetUsers(); break; case 2: InsertUser($param); break; case 3: UpdateUser($param); break; case 4: GetUserInfo($param); break; case 5: DelUser($param); break; } function GetUsers() { $sql = "SELECT `user_name` FROM `keys` WHERE 1"; $rr = array(); include "db_config.php"; $result = mysqli_query($con, $sql); $i = 0;