} function getAllfromtable($login_request){ $sql = 'SELECT `user_id`,`login` FROM users WHERE login LIKE :login'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':login'=>'%'.$login_request.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } } //-- Relevant Search Starts if($login_request){ //-- Get Data From Main Class & Func $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($login_request); $mainResult[] = $arrLogin; $counter=0; foreach($mainResult[0] as $Items){ if (preg_match("/^$login_request/", $Items['login'])) { $matchArr[$counter]['user_id'] = $Items['user_id']; $matchArr[$counter++]['login'] = $Items['login']; } } //-- sort this array ASC if($matchArr){ asort($matchArr); }
public $arrBest; public $db; function __construct(){ $this->db = new Database(); } function getAllfromtable($param){ $sql = 'SELECT * FROM aliases WHERE alias_id = :alias_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':alias_id'=>$param)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($param); ?> <div class="delete-user-fancy-box"> <? //explode Array $arrExpld = explode(',',$arrLogin['alias']); ?> <form id="a_makeForm" action="#" method="POST"> <table> <tr> <td><label for="cor_username">username</label></td> <td style="position:relative;"> <input autocomplete="off" class="field-tpl widthfldupd" id="cor_username" type="text" name="cor_username" value="">
$tb->execute(array(':reply_login'=>$username,':reply_msg'=>$repl_msg)); } function ChangeChk($username,$autoCheck){ $sql = 'UPDATE bcc SET active=:active_chk WHERE bcc_name = :reply_login'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':reply_login'=>$username,':active_chk'=>$autoCheck)); } function writeLoging($inneruserId,$rzlt){ $sql = 'INSERT INTO loging (`tmlog`,`login_id`,`moving`,`rzlt`,`vargroup`,`ipuser`) VALUES (NOW(),:login_id,"редактирование",:rzlt,"2","'.$_SERVER["REMOTE_ADDR"].'")'; $tb = $this->dbIt->connection->prepare($sql); $tb->execute(array(':login_id'=>$inneruserId,':rzlt'=>$rzlt)); } } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($user_id,$username,$datefrom,$email,$datefrom,$dateto); $getData ->writeLoging($_SESSION['user_id'],$username); //--auto replay msg $arrCheck = $getData ->checkIfExAutoReply($bcc_names); if($arrCheck['bcc_id']){ if(!$repl_msg==''){ $getData ->UpdAutoReply($bcc_names,$repl_msg); } $arrChkBox = $getData -> ChangeChk($bcc_names,$autoCheck); }else{ $arrInsertRepl = $getData ->writeInAutoReply($bcc_names,$bcc_maps,$repl_msg,$autoCheck); } ?>
function __construct(){ $this->db = new DatabaseItDept(); } function getAllfromtable($idGroup,$nameGroup,$grp_createuser,$grp_view,$grp_view2,$grp_correct,$grp_correct2,$grp_createuser2,$komment_group,$grp_createuser3,$grp_view3,$grp_correct3){ if($grp_view == 'on'){$grp_view='1';}else{$grp_view='0';} if($grp_view2 == 'on'){$grp_view2='1';}else{$grp_view2='0';} if($grp_view3 == 'on'){$grp_view3='1';}else{$grp_view3='0';} if($grp_correct == 'on'){$grp_correct='1';}else{$grp_correct='0';} if($grp_correct2 == 'on'){$grp_correct2='1';}else{$grp_correct2='0';} if($grp_correct3 == 'on'){$grp_correct3='1';}else{$grp_correct3='0';} if($grp_createuser == 'on'){$grp_createuser='******';}else{$grp_createuser='******';} if($grp_createuser2 == 'on'){$grp_createuser2='1';}else{$grp_createuser2='0';} if($grp_createuser3 == 'on'){$grp_createuser3='1';}else{$grp_createuser3='0';} //echo $grp_view3; //-- WRITING DB $sql = 'UPDATE levels SET level_name = :level_name WHERE level_id = :level_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':level_id' => $idGroup,':level_name'=>$nameGroup)); $sql = 'UPDATE operations SET oper_view_staff = :oper_view_staff, oper_correct_staff = :oper_correct_staff, oper_create_staff = :oper_create_staff, oper_create_post = :oper_create_post,oper_view_post = :oper_view_post,oper_correct_post = :oper_correct_post,oper_create_forw = :oper_create_forw,oper_view_forw = :oper_view_forw,oper_correct_forw = :oper_correct_forw,komment_group = :komment_group WHERE oper_connect_id = :oper_connect_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':oper_connect_id'=>$idGroup,':oper_create_post'=>$grp_createuser,':oper_view_post'=>$grp_view,':oper_correct_post'=>$grp_correct,':oper_create_forw'=>$grp_createuser2,':oper_view_forw'=>$grp_view2,'oper_correct_forw'=>$grp_correct2,'komment_group'=>$komment_group,':oper_create_staff'=>$grp_createuser3,':oper_view_staff'=>$grp_view3,':oper_correct_staff'=>$grp_correct3)); } } $getData = new mainpage_query(); $arrGetter = $getData ->getAllfromtable($idGroup,$nameGroup,$grp_createuser,$grp_view,$grp_view2,$grp_correct,$grp_correct2,$grp_createuser2,$komment_group,$grp_createuser3,$grp_view3,$grp_correct3); ?>
}else{ if(strlen($nameGroup)=='0'){ $this->rezArr[0]['level']['mistakeIU'] = 'mistake'; $this->rezArr[0]['level']['msg'] = 'Группа не должна быть с пустым названием'; $mistake = 1; }else{ $this->rezArr[0]['level']['mistakeIU'] = 'nomistake'; } } } if($grp_view2 != 'on' AND $grp_view != 'on' AND $grp_view3 != 'on'){ $this->rezArr[0]['view']['mistakeIU'] = 'mistake'; $this->rezArr[0]['view']['msg'] = 'Нужно выбрать одну из галочек просмотр'; $mistake = 1; }else{ $this->rezArr[0]['view']['mistakeIU'] = 'nomistake'; } return $this->rezArr; } } $getData = new mainpage_query(); $arrGetter = $getData ->getAllfromtable($FirstNameGroup,$nameGroup,$grp_createuser,$grp_view,$grp_view2,$grp_correct,$grp_correct2,$grp_createuser2,$grp_view3); echo json_encode($arrGetter); ?>
class mainpage_query{ public $arrBest; public $db; function __construct(){ $this->db = new Database(); } function getAllfromtable($sql){ $tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); $arrLogin = $getData -> getAllfromtable($sql); $arrList = array(); $counter = 0; foreach($arrLogin as $Items){ $arrList[] = $Items; } foreach($arrList as $arItMs){ //if(date("m-d-Y", strtotime($arItMs['userdate']) === '01-01-1970')){ //$arrList[$counter]['userdate'] = '00-00-0000'; //}else{ $arrList[$counter]['userdate'] = date("d-m-Y", strtotime($arItMs['userdate'])); if(date("d-m-Y", strtotime($arItMs['userdate'])) == '01-01-1970'){$arrList[$counter]['userdate'] = '00-00-0000';} //} $counter ++;
$sql = 'SELECT * FROM inner_users WHERE user_login = :login ORDER BY user_id DESC'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':login'=>$login_request)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } function getDataGrps($grpLevel){ $sql = 'SELECT * FROM levels WHERE level_id = :level'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':level'=>$grpLevel)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($login_request,$pass_write,$field_inner_levels,$salt,$field_inner_surname,$field_inner_name); $getter = $getData ->getDatafromtable($login_request); $getterGrp = $getData ->getDataGrps($getter['user_level']); ?> <!-- Rezult adding to the DB Showing --> <div class="content-wrapper-alias" style="display: block;"> <h1 class="result-header">Рузультат добавления в базу данных</h1> <div class="result-blocks"><b>id пользователя: </b><b style="color:#0044cc"><?php echo $getter['user_id']; ?> </b></div> <div class="result-blocks"><b>username: </b><?php echo $getter['user_login'];
public $db; function __construct(){ $this->db = new Database(); } function getAllfromtable($param){ $sql = 'SELECT * FROM aliases WHERE alias_id = :alias_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':alias_id'=>$param)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); foreach($_GET as $DelUsers){ $arrUsers[] = $getData ->getAllfromtable($DelUsers); } //-- make string $cnt = 0; $string = ''; foreach($_GET as $userDellNumbers){ $cnt++; if($cnt == count($_GET)){ $string .= 'del_user_'. $cnt . '=' . $userDellNumbers; }else{ $string .= 'del_user_'. $cnt . '=' . $userDellNumbers . '&' ; } } //echo $string;
$tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$loginid_before,':login'=>$login_request,':level'=>$field_inner_levels,':name'=>$field_inner_name,':surname'=>$field_inner_surname,':active'=>$field_inner_active)); } function PassCorrect($pass_write,$loginid_before,$salt){ $sql = 'UPDATE inner_users SET user_pass=:pass, salt=:salt WHERE user_id=:user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':pass'=>$pass_write,':salt'=>$salt,':user_id'=>$loginid_before)); } function SidCorrect($loginid_before){ $sql = 'UPDATE inner_users SET sid=1 WHERE user_id=:user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$loginid_before)); } } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($login_request,$field_inner_levels,$field_inner_surname,$field_inner_name,$loginid_before,$field_inner_active); //if pass strlength>5 and all the Condtions srart function if(strlen($field_inner_pass)>5){ $arrLogin = $getData ->PassCorrect($pass_write,$loginid_before,$salt); } if($field_inner_active == 0){ $getData -> SidCorrect($loginid_before); } //$getter = $getData ->getDatafromtable($login_request); /*$levels = array( '1'=>'admin',
$sername = $userData['staff_lastname']; $username = $userData['staff_name']; } $sql = 'UPDATE users SET login=:login, password=:password, email=:email, sername=:sername, name=:username, mailbox=:mailbox, userdate=:userdate, domain_id=:domain_id, active=:active, staff_id=:staff_id WHERE user_id=:user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$user_id,':login'=>$login,':password'=>$password,':email'=>$email,':username'=>$username,':sername'=>$sername,':mailbox'=>$mailbox,':userdate'=>date('Y-m-d',strtotime($userdate)),':domain_id'=>$domain_id,':active'=>$active,':staff_id'=>$profile_create)); /*$this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest;*/ } function writeLoging($inneruserId,$rzlt){ $sql = 'INSERT INTO loging (`tmlog`,`login_id`,`moving`,`rzlt`,`vargroup`,`ipuser`) VALUES (NOW(),:login_id,"редактирование",:rzlt,"1","'.$_SERVER["REMOTE_ADDR"].'")'; $tb = $this->dbIt->connection->prepare($sql); $tb->execute(array(':login_id'=>$inneruserId,':rzlt'=>$rzlt)); } function writeLogingBlocking($inneruserId,$rzlt){ $sql = 'INSERT INTO loging (`tmlog`,`login_id`,`moving`,`rzlt`,`vargroup`) VALUES (NOW(),:login_id,"блокирование",:rzlt,"1")'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':login_id'=>$inneruserId,':rzlt'=>$rzlt)); } } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($user_id,$login,$password,$email,$username,$sername,$mailbox,$userdate,$domain_id,$active,$profile_create); $getData ->writeLoging($_SESSION['user_id'],$login); if(empty($active)){ $getData ->writeLogingBlocking($_SESSION['user_id'],$login); } ?>
} function getAllfromtable($email_request){ $sql = 'SELECT `user_id`,`email` FROM users WHERE email LIKE :email'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':email'=>'%'.$email_request.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } } //-- Relevant Search Starts if($email_request){ //-- Get Data From Main Class & Func $getData = new mainpage_query(); $arremail = $getData ->getAllfromtable($email_request); $mainResult[] = $arremail; $counter=0; foreach($mainResult[0] as $Items){ if (preg_match("/^$email_request/", $Items['email'])) { $matchArr[$counter]['user_id'] = $Items['user_id']; $matchArr[$counter++]['email'] = $Items['email']; } } //-- sort this array ASC if($matchArr){ asort($matchArr); }