/** * PRIVATE METHODS */ private function setLogin() { if (!$this->Email || !$this->Pass || !Check::Email($this->Email)) { $this->Error = ["Enter email and pass to perform Login!", WS_INFO]; $this->Result = false; } elseif (!$this->GetUser()) { $this->Error = ["User and pass not found!", WS_ALERT]; $this->Result = false; } elseif ($this->Result['level'] > $this->Level) { $this->Error = ["{$this->Result['name']}, you have no power here!", WS_ERROR]; $this->Result = false; } else { $this->execute(); } }
private function setLogin() { if (!$this->Email || !$this->Senha || !Check::Email($this->Email)) { $this->Erro = "<script> alert('Infome seu E-mail e Senha Para logar no sistema'); </script>"; $this->Result = false; } elseif (!$this->getUser()) { $this->Erro = "<script> alert('E-mail ou Senha Invalidos'); </script>"; $this->Result = false; // elseif($this->Result['user_level'] < $this->Level): // $this->Erro = "<script> alert('Desculpe mas você não tem permissão para acessar o sistema!'); </script>"; // $this->Result = false; } else { $this->Execute(); } }
private function setLogin() { if (!$this->Email || !$this->Senha || !Check::Email($this->Email)) { $this->Error = ['Informe seu E-mail e senha para efetuar o login!', WS_INFOR]; $this->Result = false; } elseif (!$this->getUser()) { $this->Error = ['Os dados informados não são compatíveis!', WS_ALERT]; $this->Result = false; } elseif ($this->Result['nivel'] < $this->Level) { $this->Error = ["Desculpe {$this->Result['name']}, você não tem permissão para acessar esta área!", WS_ERROR]; $this->Result = false; } else { $this->Execute(); } }
private function setLogin() { if (!$this->Email || !$this->Pass || !Check::Email($this->Email)) { $this->Error = ['Pssiu! Informe todos os campos para efetuar o login!', WS_INFOR]; $this->Result = false; } elseif (!$this->getUser()) { $this->Error = ['Eii! Os dados não conferem!', WS_ALERT]; $this->Result = false; } elseif ($this->Result['user_level'] < $this->Level) { $this->Error = ["Desculpe {$this->Result['user_name']}, você não tem permissão para acessar esta área!", WS_ERROR]; $this->Result = false; } else { $this->Execute(); } }
public function Enviar(array $Data) { $this->Data = $Data; $this->Clear(); if (in_array('', $this->Data)) { $this->Error = ['Erro ao enviar mensagem: Para enviar esse e-mail, preencha todos os campos', TW_ALERT]; $this->Result = false; } elseif (!Check::Email($this->Data['RemetenteEmail'])) { $this->Error = ['Erro ao enviar mensagem: O e-mail que você informou não tem um formato válido. Informe um e-mail válido', TW_ALERT]; $this->Result = false; } else { $this->setMail(); $this->Config(); $this->sendMail(); } }
public function Enviar(array $Data) { $this->Data = $Data; $this->Clear(); $nome = $this->Data['RemetenteNome']; unset($this->Data['RemetenteNome']); if (in_array('', $this->Data)) { $this->Error = ['Erro ao enviar mensagem: Para enviar esse e-mail. Preencha os campos requisitados!', WS_ALERT]; $this->Result = false; } elseif (!Check::Email($this->Data['RemetenteEmail'])) { $this->Error = ['Erro ao enviar mensagem: O e-mail que você informou não tem um formato válido. Informe seu e-mail!!', WS_ALERT]; $this->Result = false; } else { $this->Data['RemetenteNome'] = $nome; $this->setMail(); $this->Config(); $this->sendMail(); } }
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; } }
public function Enviar($Data) { $this->DestinoEmail = $Data; $this->Clear(); if ($this->DestinoEmail == null) { $this->Error = ['Erro ao enviar mensagem: Para enviar esse e-mail, preencha todos os campos', TW_ALERT]; $this->Result = false; } elseif (!Check::Email($this->DestinoEmail)) { $this->Error = ['Erro ao enviar mensagem: O e-mail que você informou não tem um formato válido. Informe um e-mail válido', TW_ALERT]; $this->Result = false; } else { if ($this->getUser()) { $this->setLink(); $this->setMail(); $this->Config(); $this->sendMail(); $this->Result = true; } else { $this->Error = ['O e-mail que você digitou não existe em nosso sistema. Verifique se o digitou corretamente.', TW_ERROR]; $this->Result = false; } } }
private function setData() { if (!Check::Email($this->Data['user_email'])) { $this->Error = ['<b>Oppss, email Inválido</b>, por favor preencha corretamente o campo.', WS_ALERT]; $this->Data['user_email'] = null; $this->Result = null; } $this->Data['user_registration'] = date('Y-m-d H:i:s', time()); $this->Data['user_lastupdate'] = date('Y-m-d H:i:s', time()); $this->Data['user_password'] = md5($this->Data['user_password']); }
private function checkData() { if ($this->Userlevel == NV_SOCIOPEDAGOGIA) { $this->Data['user_login'] = strtolower($this->Data['user_name'] . $this->Data['user_lastname']); $this->Data['user_password'] = substr(sha1(md5($this->Data['user_email'] . mt_rand())), 0, 11); $this->Data['user_level'] = NV_EDUCADOR; } if (in_array('', $this->Data)) { $this->Error = ["Existem campos em branco. Favor preencha todos os campos!", TW_ALERT]; $this->Result = false; } elseif (!Check::Email($this->Data['user_email'])) { $this->Error = ["O e-email informado não parece ter um formato válido!", TW_ALERT]; $this->Result = false; } elseif (isset($this->Data['user_password']) && (strlen($this->Data['user_password']) < 6 || strlen($this->Data['user_password']) > 12)) { $this->Error = ["A senha deve ter entre 6 e 12 caracteres!", TW_INFOR]; $this->Result = false; } else { $this->checkEmail(); } }
private function setData() { $cover = !empty($this->Data['user_cover']) ? $this->Data['user_cover'] : NULL; unset($this->Data['user_cover']); $this->Data = array_map('strip_tags', $this->Data); $this->Data = array_map('trim', $this->Data); $this->Data['user_birthday'] = Check::Data($this->Data['user_birthday']); $this->Data['user_cover'] = !empty($cover) ? $cover : NULL; if (!Check::Email($this->Data['user_email'])) { $this->Error = ['<b>Oppss, email Inválido</b>, por favor preencha corretamente o campo.', WS_ALERT]; $this->Data['user_email'] = null; $this->Result = null; } // $this->Data['user_level'] = 5; $this->Data['user_status'] = 1; $this->Data['user_registration'] = date('Y-m-d H:i:s', time()); $this->Data['user_lastupdate'] = date('Y-m-d H:i:s', time()); if (!empty($this->Data['user_password'])) { $this->Data['user_password'] = md5($this->Data['user_password']); } else { unset($this->Data['user_password']); } }
private function checkData() { if (in_array('', $this->Data)) { $this->Error = ["Existem campos em branco. Favor preencha todos os campos!", WS_ALERT]; $this->Result = false; } elseif (!Check::Email($this->Data['user_email'])) { $this->Error = ["O e-email informado não parece ter um formato válido!", WS_ALERT]; $this->Result = false; } elseif (isset($this->Data['user_password']) && (strlen($this->Data['user_password']) < 6 || strlen($this->Data['user_password']) > 12)) { $this->Error = ["A senha deve ter entre 6 e 12 caracteres!", WS_INFOR]; $this->Result = false; } else { $this->checkEmail(); } }
<!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title>WS PHP - Helpers :: Manipulação e Validação</title> </head> <body> <?php require './_app/Config.inc.php'; //$check = new Check(); //var_dump($check); $Email = 'bruno.gmail.com'; if (Check::Email($Email)) { echo 'Válido!<hr>'; } else { echo 'Inválido!<hr>'; } $Name = 'Estamos aprendendo PHP. Veja você como é!'; echo Check::Name($Name) . '<hr>'; $Data = '21/12/2015 20:36:10'; echo Check::Data($Data) . '<hr>'; ?> </body> </html>
$getPost = filter_input_array(INPUT_POST, FILTER_DEFAULT); $setPost = array_map('strip_tags', $getPost); $post = array_map('trim', $setPost); $Action = $post['action']; $jSon = array(); 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>"; } }