private function getUser()
 {
     $this->Senha = md5($this->Senha);
     $WsUsers = new WsUsers();
     $WsUsers->setUser_email($this->Email);
     $WsUsers->setUser_password($this->Senha);
     $WsUsers->Query("WHERE #user_email# AND #user_password#");
     if ($WsUsers->getResult()) {
         $this->Result = $WsUsers->getResult()[0];
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
 private function getUser()
 {
     $this->Senha = md5($this->Senha);
     $WsUsers = new WsUsers();
     if (Check::Email($this->Email)) {
         $WsUsers->setUser_email($this->Email);
         $login = '******';
     } else {
         $WsUsers->setUser_nickname($this->Email);
         $login = '******';
     }
     $WsUsers->setUser_password($this->Senha);
     $WsUsers->Execute()->Query("{$login} AND #user_password# AND user_status = 1");
     if ($WsUsers->Execute()->getResult()) {
         $this->Result = $WsUsers->Execute()->getResult()[0];
         $this->Result->area_trabalho = $this->getAreaTrabalho($this->Result->area_id);
         $this->Result->perfil = $this->getPerfil($this->Result->perfil_id);
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
unset($post['action']);
sleep(1);
if ($Action) {
    require '../_app/Config.inc.php';
    $WsUsers = new WsUsers();
}
switch ($Action) {
    case 'create':
        if (in_array('', $post)) {
            $jSon['error'] = "<b>OPPPSSS:</b> Para cadastraro um usuário preencha todos os campos";
        } elseif (!Check::Email($post['user_email']) || !filter_var($post['user_email'], FILTER_VALIDATE_EMAIL)) {
            $jSon['error'] = "<b>OPPPSSS:</b> Favor informe um email válido!";
        } elseif (strlen($post['user_password']) < 5 || strlen($post['user_password']) > 10) {
            $jSon['error'] = "<b>OPPPSSS:</b> Sua Senha deve ter entre 5 e 10 caracteres!";
        } else {
            $WsUsers->setUser_email($post['user_email']);
            $WsUsers->Execute()->FullRead("SELECT user_id FROM ws_users WHERE #user_email#");
            if ($WsUsers->Execute()->getResult()) {
                $jSon['error'] = "<b>OPPPSSS:</b> O email {$post['user_email']} ja esta em uso!";
            } else {
                $WsUsers->setThis((object) $post);
                $WsUsers->Execute()->insert();
                $jSon['success'] = "Cadastro com sucesso!";
                $jSon['result'] = "<article style='display: none' class='user_box j_register' id='{$WsUsers->Execute()->MaxFild('user_id')}'><h1> {$post['user_name']} {$post['user_lastname']} </h1><p>{$post['user_email']} (Nível {$post['user_level']})</p><a class='action edit j_edit' rel='{$WsUsers->Execute()->MaxFild('user_id')}'>Editar</a><a class='action del' rel='{$WsUsers->Execute()->MaxFild('user_id')}'>Deletar</a></article>";
            }
        }
        break;
    case 'loadmore':
        $jSon['result'] = null;
        $WsUsers = new WsUsers();
        $WsUsers->Execute()->FullRead("SELECT * FROM ws_users ORDER BY user_id DESC LIMIT :limit OFFSET :offset", "limit=2&offset={$post['offset']}", true);