prepare($sql); $sth->execute([$language, $imagesize, $imagecount, $mac, $dateformat, $dns1suffix, $dns2suffix, $tooltips, implode(',', $menu), $id]); $_SESSION['suser_language'] = $language; $_SESSION['suser_imagesize'] = $imagesize; $_SESSION['suser_imagecount'] = $imagecount; $_SESSION['suser_mac'] = $mac; $_SESSION['suser_dateformat'] = $dateformat; $_SESSION['suser_dns1suffix'] = $dns1suffix; $_SESSION['suser_dns2suffix'] = $dns2suffix; $_SESSION['suser_menu_assets'] = $menu_assets; $_SESSION['suser_menu_assetclasses'] = $menu_assetclasses; $_SESSION['suser_menu_assetclassgroups'] = $menu_assetclassgroups; $_SESSION['suser_menu_cables'] = $menu_cables; $_SESSION['suser_menu_locations'] = $menu_locations; $_SESSION['suser_menu_nodes'] = $menu_nodes; $_SESSION['suser_menu_subnets'] = $menu_subnets; $_SESSION['suser_menu_vlans'] = $menu_vlans; $_SESSION['suser_menu_zones'] = $menu_zones; $_SESSION['suser_tooltips'] = $tooltips; $action = ACT_DEFAULT; break; case 'exec-pass': $user_id = $_SESSION['suser_id']; $currentpass = sanitize($_POST['user_currentpass']); $newpass1 = sanitize($_POST['user_newpass1']); $newpass2 = sanitize($_POST['user_newpass2']); $sth = $dbh->prepare("SELECT user_pass FROM user WHERE user_id=?"); $sth->execute([$user_id]); $userpass = $sth->fetchColumn(); $action = ACT_PASSWORD; if (password_verify($currentpass, $userpass)) { if (strlen($newpass1) >= 5) { if (!strcmp($newpass1, $newpass2)) { $sth = $dbh->prepare("UPDATE user SET user_pass=? WHERE user_id=?"); $newhash = password_hash($newpass1, PASSWORD_BCRYPT); $sth->execute([$newhash, $user_id]); $action = ACT_DEFAULT; } else { $g_error->Add('New passwords do not match!'); } } else { $g_error->Add('New password is to simple!'); } } else { $g_error->Add('Current password wrong!'); } break; default: $g_error->Add(submit_error($submit)); $valid = FALSE; } // ========== ACTIONS END ===================================================== include("header.php"); if ($action == ACT_DEFAULT): // ========== VARIANT: default behavior ======================================= $smarty->assign('realm', $_SESSION['suser_realm']); $smarty->assign('role_add', $_SESSION['suser_role_add']); $smarty->assign('role_edit', $_SESSION['suser_role_edit']); $smarty->assign('role_delete', $_SESSION['suser_role_delete']); $smarty->assign('role_manage', $_SESSION['suser_role_manage']); $smarty->assign('role_admin', $_SESSION['suser_role_admin']); $smarty->display("options.tpl"); elseif ($action == ACT_EDIT): // ========== VARIANT: edit display options =================================== $smarty->assign("language", $language); if($_SESSION['suser_menu_assets']=='on') { $user_menu_assets_checked = 'checked'; } else { $user_menu_assets_checked = ''; } // assetclasses if($_SESSION['suser_menu_assetclasses']=='on') { $user_menu_assetclasses_checked = 'checked'; } else { $user_menu_assetclasses_checked = ''; } // assetclassgroups if($_SESSION['suser_menu_assetclassgroups']=='on') { $user_menu_assetclassgroups_checked = 'checked'; } else { $user_menu_assetclassgroups_checked = ''; } // cables if($_SESSION['suser_menu_cables']=='on') { $user_menu_cables_checked = 'checked'; } else { $user_menu_cables_checked = ''; } // locations if($_SESSION['suser_menu_locations']=='on') { $user_menu_locations_checked = 'checked'; } else { $user_menu_locations_checked = ''; } // nodes if($_SESSION['suser_menu_nodes']=='on') { $user_menu_nodes_checked = 'checked'; } else { $user_menu_nodes_checked = ''; } // subnets if($_SESSION['suser_menu_subnets']=='on') { $user_menu_subnets_checked = 'checked'; } else { $user_menu_subnets_checked = ''; } // vlans if($_SESSION['suser_menu_vlans']=='on') { $user_menu_vlans_checked = 'checked'; } else { $user_menu_vlans_checked = ''; } // zones if($_SESSION['suser_menu_zones']=='on') { $user_menu_zones_checked = 'checked'; } else { $user_menu_zones_checked = ''; } // tooltips if($_SESSION['suser_tooltips']=='on') { $user_tooltips_checked = 'checked'; } else { $user_tooltips_checked = ''; } $smarty->assign("user_id", $_SESSION['suser_id']); $smarty->assign("user_imagesize", $_SESSION['suser_imagesize']); $smarty->assign("user_imagecount", $_SESSION['suser_imagecount']); $smarty->assign("user_mac", $_SESSION['suser_mac']); $smarty->assign("user_dateformat", $_SESSION['suser_dateformat']); $smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']); $smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']); $smarty->assign("user_language", $_SESSION['suser_language']); $smarty->assign("user_menu_assets_checked", $user_menu_assets_checked); $smarty->assign("user_menu_assetclasses_checked", $user_menu_assetclasses_checked); $smarty->assign("user_menu_assetclassgroups_checked", $user_menu_assetclassgroups_checked); $smarty->assign("user_menu_cables_checked", $user_menu_cables_checked); $smarty->assign("user_menu_locations_checked", $user_menu_locations_checked); $smarty->assign("user_menu_nodes_checked", $user_menu_nodes_checked); $smarty->assign("user_menu_subnets_checked", $user_menu_subnets_checked); $smarty->assign("user_menu_vlans_checked", $user_menu_vlans_checked); $smarty->assign("user_menu_zones_checked", $user_menu_zones_checked); $smarty->assign("user_tooltips_checked", $user_tooltips_checked); $smarty->display("optionseditdisplay.tpl"); elseif ($action == ACT_PASSWORD): // ========== VARIANT: password =============================================== $smarty->display("optionseditpassword.tpl"); else: // ========== ERROR UNKNOWN VARIANT =========================================== echo "
Unknown function call: Please report to system development!
\n"; endif; // $action == ... // ========== END OF VARIANTS ================================================= $smarty->display('footer.tpl'); ?>