function userAccess() { // Pegando dados de ACESSO do cliente Q::db()->query('INSERT INTO access (REQUEST,METHOD,REMOTE,AGENT,ACCEPT,ENCODING,LANGUAGE,IDATE) VALUES (:req,:met,:rem,:age,:acc,:enc,:lan,:idate)', [':req' => $_SERVER['REQUEST_URI'], ':met' => $_SERVER['REQUEST_METHOD'], ':rem' => $_SERVER['REMOTE_ADDR'], ':age' => $_SERVER['HTTP_USER_AGENT'], ':acc' => $_SERVER['HTTP_ACCEPT'], ':enc' => $_SERVER['HTTP_ACCEPT_ENCODING'], ':lan' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], ':idate' => date('Y-m-d H:I:s')]); Q::db()->query('DELETE FROM access WHERE DATE(access.IDATE) <= DATE(DATE(NOW())-30)'); }
function getLogin($login, $passw) { //check login/md5(user) Q::db('sysuser')->query('SELECT CONCAT(primeiro_nome, " ", segundo_nome)NAME, id as ID FROM `erp_usuarios` WHERE email = :login AND senha = :passw AND ativo = 1', [':login' => $login, 'passw' => md5($passw)]); $res = Q::db('sysuser')->result(); if ($res === false) { return false; } else { return $res[0]; } }
function getUserList() { Q::db()->query('SELECT * FROM users'); $rs = Q::db()->result(); if ($rs === false) { return false; } $o = []; foreach ($rs as $col) { $o[$col->ID]['id'] = $col->ID; $o[$col->ID]['name'] = $col->NAME; $o[$col->ID]['last'] = $col->LAST; } return $o; }
function getUserList() { //Q::db()->query('SELECT * FROM users'); //OR use a view Q::db()->query('SELECT * FROM view_msg_from_users'); $rs = Q::db()->result(); if ($rs === false) { return false; } $o = []; foreach ($rs as $col) { $o[$col->ID]['id'] = $col->ID; $o[$col->ID]['name'] = $col->NAME; $o[$col->ID]['last'] = $col->LAST; $o[$col->ID]['total'] = $col->TOTAL; $o[$col->ID]['type'] = $col->TYPE; } return $o; }