Execute("insert into users (internally, login, password, lastname, firstname, secondname) values ('".$_POST["internally"]."', '".$_POST["login"]."', MD5('".$_POST["passwd1"]."'), '".$_POST["lastname"]."', '".$_POST["firstname"]."', '".$_POST["secondname"]."')"); } setprivileges($_POST["login"]); # После этих операций данные не будем брать из кеша. header("Location: ?cacheflush=1"); die; } else if (isset($_POST["edit"]) && $_POST["edit"]) { if(!$demoMode){ $conn->Execute("delete from usersgroups where login = '".$_POST["edit"]."'"); } $q4="SELECT 0 FROM users WHERE login = '".$_POST["edit"]."'"; $res = $conn->Execute($q4); if (isset($res->fields[0])){ if(!$demoMode){ $conn->Execute("update users set internally='".$_POST["internally"]."', login = '".$_POST["login"]."', lastname = '".$_POST["lastname"]."', firstname = '".$_POST["firstname"]."', secondname = '".$_POST["secondname"]."' where login = '".$_POST["edit"]."'"); } }else{ if(!$demoMode){ $conn->Execute("insert into users (internally, login, password, lastname, firstname, secondname) values ('".$_POST["internally"]."', '".$_POST["login"]."', MD5('".$_POST["passwd1"]."'), '".$_POST["lastname"]."', '".$_POST["firstname"]."', '".$_POST["secondname"]."')"); } } setprivileges($_POST["login"]); # После этих операций данные не будем брать из кеша. header("Location: ?cacheflush=1"); die; } else if (isset($_POST["resetpwd"]) && $_POST["resetpwd"]) { if ($_POST["passwd1"] != $_POST["passwd2"]) { header("Location: ?msg=2"); die; } if(!$demoMode){ $conn->Execute("update users set password = MD5('".$_POST["passwd1"]."') where login = '".$_POST["resetpwd"]."'"); } # После этих операций данные не будем брать из кеша. header("Location: ?cacheflush=1"); die; } else if (isset($_GET["delete"]) && $_GET["delete"]) { if(!$demoMode){ $conn->Execute("delete from usersgroups where login = '".$_GET["delete"]."'"); $conn->Execute("delete from users where login = '".$_GET["delete"]."'"); } # После этих операций данные не будем брать из кеша. header("Location: ?cacheflush=1"); die; } $title=strtr($GUI_LANG['ManagementOfAbonents'],$GUI_LANG['UpperCase'],$GUI_LANG['LowerCase']); if(empty($export)) include("../include/set/header.html"); ?>
".$GUI_LANG['ChangeDefaultAdminPassword']."
 "; ?>
 
".$GUI_LANG['Abonents'].":"; if(isset($_GET["msg"])){ switch ($_GET["msg"]) { case 2: echo "
".$GUI_LANG['PasswordsDoNotConsilient']."

"; break; case 3: echo "
".$GUI_LANG['EnterLoginName']."

"; break; } } $q2="select internally, login, lastname, firstname, secondname from users order by login"; if($debug) echo $q2."
"; $q1="SELECT calls.internally,intphones.name FROM calls LEFT JOIN intphones ON intphones.intnumber = calls.internally group by calls.internally,intphones.name order by internally ASC"; if($debug) echo $q1."
"; $conn->setFetchMode(ADODB_FETCH_NUM); if(isset($cacheflush) && $cacheflush) $res1 = $conn->CacheFlush($q1); $res1 = $conn->CacheExecute($q1); if ($res1 && $res1->RecordCount() > 0) { while (!$res1->EOF) { $mamba=$res1->fields; $names=split(" ",$mamba[1]); $allIntern[]=array(0 => $mamba[0],1 => $mamba[0],5 => (isset($names[0])?$names[0]:''),6 => (isset($names[1])?$names[1]:''),7 => (isset($names[2])?$names[2]:'')); $res1->MoveNext(); } } $conn->setFetchMode(ADODB_FETCH_NUM); if(isset($cacheflush) && $cacheflush) $res = $conn->CacheFlush($q2); $res = $conn->CacheExecute($q2); if ($res && $res->RecordCount() > 0) { while (!$res->EOF) { $allRows[]=$res->fields; $res->MoveNext(); } } if(!empty($allIntern)){ while (list($k, $v) = each($allIntern)) { if(!empty($allRows)){ reset($allRows); while (list($ke, $va) = each($allRows)) { if ($v[0]==$va[0]){ $dobavit=FALSE; break; }else{ $dobavit=TRUE; } } }else{ $dobavit=TRUE; } if($dobavit){ $allRows[]=$v; } } } if(!empty($allRows)){ reset($allRows); ksort($allRows); } echo "
"; if(!empty($allRows)){ while (list($key, $row) = each($allRows)) { if(isset($row[2]) or isset($row[3]) or isset($row[4])){ $comment=array($row[2],$row[3],$row[4]); $shmayster=FALSE; }else{ $comment=array($row[5],$row[6],$row[7]); $shmayster=TRUE; } echo "\n\n"; echo "\n"; echo "\n"; echo "\n"; showprivileges($row[1], false); echo "\n"; } else { echo "\"\""; echo "\n"; echo "\n\n"; showprivileges($row[1], true); echo "\n"; } echo "\n"; } } echo ""; echo ""; echo ""; echo ""; showprivileges(null, false); echo "\n\n"; echo "
 ".$GUI_LANG['InternalPhone']."".$GUI_LANG['Login']."".$GUI_LANG['Initials']."".$GUI_LANG['Permissions']." 
"; if (isset($_GET["edit"]) && $_GET["edit"] == $row[1]) { echo "\"\"

\n"; echo "
\n"; echo "
\"".$GUI_LANG['Cancel']."\"".htmlspecialchars($row[0])."".htmlspecialchars($row[1])."
"; if (isset($_GET["resetpwd"]) && $_GET["resetpwd"] == $row[1]) { echo "
".$GUI_LANG['Password'].":
".$GUI_LANG['OnceAgain'].":  \"".$GUI_LANG['Cancel']."\"
"; } echo "
\n"; for ($i = 0; $i < 3; $i++) if($shmayster){ echo ""; echo htmlspecialchars($comment[$i])."
\n"; echo "
"; }else{ echo htmlspecialchars($comment[$i])."
\n"; } echo "
\"".$GUI_LANG['Edit']."\""; if (!isset($_GET["resetpwd"]) || $_GET["resetpwd"] != $row[1]) echo "\"".$GUI_LANG['ChangePassword']."\""; echo "\"".$GUI_LANG['Delete']."\"
\"\"
 
".$GUI_LANG['Login'].": 
".$GUI_LANG['Password'].": 
".$GUI_LANG['OnceAgain'].": 
".$GUI_LANG['Initials'].":

"; echo "
"; echo "
"; include("../include/set/footer.html"); ?>