$tb->execute(array(':login'=>$username)); $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)); } } //print_r($_GET); $count=0; $dellData = new mainpage_query(); foreach($_GET as $DelUsers){ $count++; $userGet = $dellData -> getDatafromtableUsers($DelUsers); if(count($_GET)==$count){ $email .= $userGet['login']; }else{ $email .= $userGet['login'] .', '; } $dellData ->Deletefromtable($DelUsers); } $dellData ->writeLoging($_SESSION['user_id'],$email); ?>
}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';} //}
class mainpage_query{ public $arrBest; public $db; function __construct(){ $this->db = new DatabaseItDept(); } function getLoginfromtable($login_request){ $sql = 'SELECT * FROM inner_users WHERE user_login = :login'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':login'=>$login_request)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); $takeUser = $getData ->getLoginfromtable($login_request); //--userPHPvalidation if($takeUser['user_id'] AND $takeUser['user_id'] != $loginid_before){ $rezArr[0]['login']['exitsIU'] = 'noway'; $rezArr[0]['login']['mistakeIU'] = 'mistake'; $rezArr[0]['login']['msg'] = 'Такой логин уже есть в системе'; }else{ $rezArr[0]['login']['exitsIU'] = 'goyes'; if(preg_match("/[\s,*?&^%><+\$№#`~=!АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя]/", $login_request)){ $rezArr[0]['login']['mistakeIU'] = 'mistake'; $rezArr[0]['login']['msg'] = 'Логин не должен использовать знаки русского алфавита и различные символы'; }else{ if(strlen($login_request)<='3'){ $rezArr[0]['login']['mistakeIU'] = 'mistake';
$this->db = new Database(); } 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); }
<? require '../../db.php'; $param = $_GET['finDel']; class mainpage_query{ public $arrBest; public $db; function __construct(){ $this->db = new DatabaseItDept(); } function Deletefromtable($param){ $sql = 'DELETE FROM inner_users WHERE user_id=:user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$param)); } } $dellData = new mainpage_query(); $dellData ->Deletefromtable($param); ?>
public $arrBest; public $arrCheckRepl; public $db; function __construct(){ $this->db = new DatabaseItDept(); } function getDatafromtable($login_request){ $sql = 'SELECT * FROM inner_users WHERE user_id = :loginID'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':loginID'=>$login_request)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query(); $getter = $getData ->getDatafromtable($user_id); ?> <!-- Rezult adding to the DB Showing --> <div class="delete-user-fancy-box" style="width:260px;"> <div class="header-delete-user-fancybox">Вы уверены, что хотите удалить именно этого пользователя?</div> <div class="result-blocks"><b>id пользователя: </b><b style="color:#0044cc"><?php echo $getter['user_id']; ?> </b></div> <div class="result-blocks"><b>login: </b> <b style="color:#0044cc"><?php echo $getter['user_login']; ?> </b></div>
$sql = 'UPDATE inner_users SET user_login=:login, user_level=:level, user_name=:name, user_surname=:surname, active=:active WHERE user_id=:user_id'; $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(
class mainpage_query{ 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(); 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 . '&' ; }
$tb->execute(array(':keyword'=>'%'.$search.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } function getAllfromtableSername($search,$blocked){ $sql = 'SELECT *, DATE_FORMAT(userdate,"%d-%m-%Y") as userdate FROM users WHERE'.$blocked.' sername LIKE :keyword'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':keyword'=>'%'.$search.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } } if($search){ $getData = new mainpage_query(); if($methodSearch=='login'){ $arrSearch = $getData ->getAllfromtableLogin($search,$blocked); } if($methodSearch=='email'){ $arrSearch = $getData ->getAllfromtableEmail($search,$blocked); } if($methodSearch=='name'){ $arrSearch = $getData ->getAllfromtableName($search,$blocked); } if($methodSearch=='sername'){ $arrSearch = $getData ->getAllfromtableSername($search,$blocked);
require 'db.php'; class mainpage_query{ public $arrBest; public $items; public $db; function __construct(){ $this->db = new Database(); } function deleteRows(){ $sql = 'SELECT * FROM aliases WHERE DATE_FORMAT(aliasdateto, "%Y-%m-%d") < DATE_FORMAT(NOW(), "%Y-%m-%d") AND aliasdateto!="0000-00-00 00:00:00"'; $tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); foreach($this->arrBest as $Items){ $userName = $Items['username'].'@bioline.ru'; $sql = 'UPDATE bcc SET active=0 WHERE bcc_name = :bcc_name'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':bcc_name'=>$userName)); } //--DELLPART $sql = 'DELETE FROM aliases WHERE DATE_FORMAT(aliasdateto, "%Y-%m-%d") < DATE_FORMAT(NOW(), "%Y-%m-%d") AND aliasdateto!="0000-00-00 00:00:00"'; $tb = $this->db->connection->prepare($sql); $tb->execute(); } } $dateWork = new mainpage_query(); $dateWork->deleteRows();
} $tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); $count = 0; $this->arrModify = $this->arrBest; foreach($this->arrBest as $Items){ $sql = 'SELECT * FROM operations WHERE oper_connect_id = :oper_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':oper_id'=>$Items['level_id'])); $this->arrChecked = $tb->fetch(PDO::FETCH_ASSOC); $this->arrModify[$count]['oper_create_post'] = $this->arrChecked['oper_create_post']; $this->arrModify[$count]['oper_view_post'] = $this->arrChecked['oper_view_post']; $this->arrModify[$count]['oper_correct_post'] = $this->arrChecked['oper_correct_post']; $this->arrModify[$count]['oper_create_forw'] = $this->arrChecked['oper_create_forw']; $this->arrModify[$count]['oper_view_forw'] = $this->arrChecked['oper_view_forw']; $this->arrModify[$count]['oper_correct_forw'] = $this->arrChecked['oper_correct_forw']; $this->arrModify[$count]['komment_group'] = $this->arrChecked['komment_group']; $count++; } return $this->arrModify; } } $getData = new mainpage_query(); $getter = $getData ->getDatafromtable($showlist); echo json_encode($getter); ?>
$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 getTextData(){ $sql = 'SELECT `active`,`bcc_autoreply_text` FROM bcc WHERE bcc_name = :reply_login'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':reply_login'=>$this->arrBest['username'].'@bioline.ru')); $this->arrC = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrC; } } function br2nl($string) { return str_replace("<br />","\r\n", $string); } $getData = new mainpage_query(); $arrLogin = $getData ->getAllfromtable($param); $arrMsg = $getData ->getTextData(); ?> <div class="delete-user-fancy-box"> <? //explode Array $arrExpld = explode(',',$arrLogin['alias']); if($arrMsg['active']=='1'){ $chkBox = '1'; } ?>
$tb->execute(array(':keyword'=>'%'.$search.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } function getAllfromtableEmail($search){ $sql = 'SELECT *, DATE_FORMAT(userdate,"%d-%m-%Y") as userdate FROM users WHERE email LIKE :keyword'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':keyword'=>'%'.$search.'%')); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } } if($search){ $getData = new mainpage_query(); if($methodSearch=='login'){ $arrSearch = $getData ->getAllfromtableLogin($search); } if($methodSearch=='email'){ $arrSearch = $getData ->getAllfromtableEmail($search); } if(count($arrSearch)==0){ $arrSearch['mistake'] = 'mistake'; }else{ }
$tb = $this->db->connection->prepare($sql); $tb->execute(array(':location_id'=>$param)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } function getMail($param){ $sql = 'SELECT * FROM users WHERE staff_id = :staff_id'; $tb = $this->dbMail->connection->prepare($sql); $tb->execute(array(':staff_id'=>$param)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query($pagiPage,$limit,$typePage,$_POST['staff_option'],$searchData); $getter = $getData ->getDatafromtable($_POST['valComp_filt'],$_POST['valDep_filt'],$_POST['valLoca_filt']); $counter = 0; foreach($getter as $arItMs){ $companyName = $getData -> getCompanyById($arItMs['staff_company_id']); $depName = $getData -> getDepById($arItMs['staff_depart_id']); $grName = $getData -> getGroupyById($arItMs['staff_group_id']); //$avatar = $getData -> getAvatar($arItMs['staff_lastname'],$arItMs['staff_name'],$arItMs['staff_secondname']); $locaName = $getData -> getLocation($arItMs['staff_location']); $UserMail = $getData -> getMail($arItMs['staff_id']); $getter[$counter]['staff_company_id'] = $companyName['company_name']; $getter[$counter]['staff_depart_id'] = $depName['department_name']; if($arItMs['staff_ats']=='0'){$getter[$counter]['staff_ats'] = '';} if($arItMs['staff_group_id']=='0'){$getter[$counter]['staff_group_id'] = '';}else{
$tb = $this->db->connection->prepare($sql); $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); }
$tb = $this->db->connection->prepare($sql); $tb->execute(array(':alias_id'=>$param)); } function getDatafromtableUsers($username){ $sql = 'SELECT * FROM aliases WHERE alias_id = :login'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':login'=>$username)); $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,"2","'.$_SERVER["REMOTE_ADDR"].'")'; $tb = $this->dbIt->connection->prepare($sql); $tb->execute(array(':login_id'=>$inneruserId,':rzlt'=>$rzlt)); } } //print_r($_GET); $dellData = new mainpage_query(); $userGet = $dellData -> getDatafromtableUsers($param); $dellData -> writeLoging($_SESSION['user_id'],$userGet['username']); $dellData ->Deletefromtable($param); ?>
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); ?>
function getDatafromtable($login_request){ $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
$this->db = new Database(); } 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); }
function getDatafromtable(){ $this->pagiPage = ($this->pagiPage-1) * $this->limit; $sql = 'SELECT * FROM loging ORDER BY id DESC LIMIT '.$this->pagiPage.','.$this->limit; $tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrBest = $tb->fetchAll(PDO::FETCH_ASSOC); return $this->arrBest; } function getUserById($userid){ $sql = 'SELECT * FROM inner_users WHERE user_id = :user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$userid)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query($pagiPage,$limit); $getter = $getData ->getDatafromtable(); $counter = 0; foreach($getter as $arItMs){ $userLogin = $getData -> getUserById($arItMs['login_id']); if(!$getter[$counter]['ipuser']){$getter[$counter]['ipuser'] = '******';} $getter[$counter]['login_id'] = $userLogin['user_login']; $getter[$counter]['tmlog'] = date("d-m-y H:i:s", strtotime($arItMs['tmlog'])); $counter ++; } echo json_encode($getter); ?>
class mainpage_query{ 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;">
if($this->arrUserLogin['user_id']){ return $this->arrUserLogin; }else{ $this->arrUserLogin['user_id'] = $userId; } } function getUserById($userid){ $sql = 'SELECT * FROM inner_users WHERE user_id = :user_id'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':user_id'=>$userid)); $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } $getData = new mainpage_query($pagiPage,$limit); if($_GET['IU-filteruser']){ $arrUser = $getData->getUserLogin($_GET['IU-filteruser']); } $arrData = $getData->getDatafromtable($_GET['IU-filtercats'],$_GET['IU-filtermoves']); $count = 0; foreach($arrData as $arrItems){ $arrAll[] = $arrItems; if($_GET['IU-filteruser']){ if(!$arrAll[$count]['ipuser']){$arrAll[$count]['ipuser'] = '******';} $arrAll[$count]['login_id'] = $arrUser['user_login']; $arrAll[$count]['login_search'] = $arrUser['user_login'];