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 ($_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 ($_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 ($_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");
?>
$user="";
if(IsDefaultPass($_SERVER['PHP_AUTH_USER'])) echo "".$GUI_LANG['ChangeDefaultAdminPassword']." ";
?> |
menucomplit("users");
?>
| |
|
echo $GUI_LANG['Abonent'].": ".$authrow["Login"]." (".$authrow["lastname"]." ".$authrow["firstname"]." ".$authrow["secondname"].")";
?>
|
echo "".$GUI_LANG['Abonents'].":";
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($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 => $names[0],6 => $names[1],7 => $names[2]);
$res1->MoveNext();
}
}
$conn->setFetchMode(ADODB_FETCH_NUM);
if($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 "
";
include("../include/set/footer.html");
?>
|