public function inserir(Usuario $usuario)
 {
     //Objetivo deste metodo é inserir um objeto no banco, fazendo-o ter persistencia.
     //utilizaremos a abstracao do SQL da classe TsqlInstruction
     //1. Foreach dos atributos . PRa cada existencia de atributo é um valor a ser adicionado.
     $instrucao = new TSqlInsert();
     $instrucao->setEntity("usuario");
     if ($usuario->getId() != null) {
         $instrucao->setRowData("id", $usuario->getId());
     }
     if ($usuario->getNome() != null) {
         $instrucao->setRowData("nome", $usuario->getNome());
     }
     if ($usuario->getLogin() != null) {
         $instrucao->setRowData("login", $usuario->getLogin());
     }
     if ($usuario->getSenha() != null) {
         $instrucao->setRowData("senha", $usuario->getSenha());
     }
     echo $instrucao->getInstruction();
     if ($this->Conexao->query($instrucao->getInstruction())) {
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
    public function alterar(Usuario $objUsuario)
    {
        try {
            $sqlComplemtento = !is_null($objUsuario->getSenha()) ? 'usu_senha = :usu_senha,' : '';
            $sqlComplemtento2 = !is_null($objUsuario->getPerfil()) ? 'per_id = :per_id, ' : '';
            $this->_stat = $this->_getConn()->prepare('UPDATE tblusuario SET usu_nome = :usu_nome,
																			 usu_email = :usu_email,																			 
																			 ' . $sqlComplemtento . $sqlComplemtento2 . '
																			 usu_login = :usu_login
																			 WHERE usu_id = :usu_id');
            $this->_stat->bindValue(':usu_id', $objUsuario->getId(), \PDO::PARAM_INT);
            $this->_stat->bindValue(':usu_nome', $objUsuario->getNome(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':usu_email', $objUsuario->getEmail(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':usu_login', $objUsuario->getLogin(), \PDO::PARAM_STR);
            if (!is_null($objUsuario->getSenha())) {
                $this->_stat->bindValue(':usu_senha', sha1($objUsuario->getSenha() . USER_HASH), \PDO::PARAM_STR);
            }
            if (!is_null($objUsuario->getPerfil())) {
                $this->_stat->bindValue(':per_id', $objUsuario->getPerfil(), \PDO::PARAM_INT);
            }
            $this->_stat->execute();
            return $this->_getLastInsertId();
        } catch (\PDOException $e) {
            throw new \model\conexao\Excecao($e->getMessage());
        }
    }
예제 #3
0
 public function salvar(\Usuario $u)
 {
     $nome = $u->getNome();
     $login = $u->getLogin();
     $senha = $u->getSenha();
     $status = $u->getStatus();
     if ($u->getId()) {
         $id = $u->getId();
         $sql = "update usuario set nome=:nome, login=:login, senha=:senha, status=:status where id=:id";
     } else {
         $id = $this->generateID();
         $u->setId($id);
         $sql = "insert into usuario (id, nome, login, senha, status) values (:id, :nome, :login, :senha, :status)";
     }
     $cnx = Conexao::getConexao();
     $sth = $cnx->prepare($sql);
     $sth->bindParam("id", $id);
     $sth->bindParam("nome", $nome);
     $sth->bindParam("login", $login);
     $sth->bindParam("senha", $senha);
     $sth->bindParam("status", $status);
     try {
         $sth->execute();
         return $u;
     } catch (Exception $exc) {
         echo $exc->getMessage();
     }
 }
예제 #4
0
 public function alterar(Usuario $objUsuario)
 {
     $v = $this->_getValidacao();
     $v->setRules($objUsuario->getId(), 'required', 'ID');
     $v->setRules($objUsuario->getNome(), 'required', 'NOME');
     $v->setRules($objUsuario->getEmail(), 'required', 'EMAIL');
     $v->setRules($objUsuario->getLogin(), 'required', 'LOGIN');
     $v->validar();
     return $this->_getRepositorio()->alterar($objUsuario);
 }
예제 #5
0
 private function qtdDelancesDo(Usuario $usuario)
 {
     $lances = $this->lances;
     $total = 0;
     foreach ($lances as $todoslances) {
         if ($todoslances->getUsuario()->getNome() == $usuario->getNome()) {
             $total++;
         }
     }
     return $total;
 }
예제 #6
0
 public function cadastrarUsuario(Usuario $usuario)
 {
     $sql = "insert into usuario (nome, senha, email, nivel, exp) values (?,?,?,?,?)";
     $query = $this->conexao->prepare($sql);
     $query->bindParam(1, $usuario->getNome());
     $query->bindParam(2, $usuario->getSenha());
     $query->bindParam(3, $usuario->getEmail());
     $query->bindParam(4, $usuario->getNivel());
     $query->bindParam(5, $usuario->getExp());
     $query->execute();
 }
예제 #7
0
 function insereUsuario(Usuario $usuario)
 {
     $senhaCrypt = md5($usuario->getSenha());
     $query = 'insert into usuarios (email,nome,login,senha,cargo) values(?,?,?,?,?)';
     $stmt = $this->con->prepare($query);
     $stmt->bindValue(1, $usuario->getEmail());
     $stmt->bindValue(2, $usuario->getNome());
     $stmt->bindValue(3, $usuario->getLogin());
     $stmt->bindParam(4, $senhaCrypt);
     $stmt->bindValue(5, $usuario->getCargo());
     return $stmt->execute();
 }
예제 #8
0
 public function inserir(Usuario $usuario)
 {
     try {
         $sql = "INSERT INTO usuario ( \r\n                    nome,\r\n                    email,\r\n                    concorrer_inscricao)\r\n                    VALUES (\r\n                    :nome,\r\n                    :email,\r\n                    :concorrer_inscricao)";
         //$stmt =  $con = new PDO("mysql:host=localhost;dbname=dbVestibular", "root", "");
         //            $p_sql = Conexao::getInstance()->pre
         $p_sql = Conexao::getInstance()->prepare($sql);
         $p_sql->bindValue(":nome", $usuario->getNome());
         $p_sql->bindValue(":email", $usuario->getEmail());
         $p_sql->bindValue(":concorrer_inscricao", $usuario->getConcorrerInscricao());
         return $p_sql->execute();
         //            header('location:sucesso.php');
     } catch (Exception $e) {
         print "Ocorreu um erro ao tentar executar esta ação, foi gerado um LOG do mesmo, tente novamente mais tarde.";
     }
 }
예제 #9
0
파일: Repositorio.php 프로젝트: maap13/fase
    public function adicionar(Usuario $objUsuario)
    {
        try {
            $this->_stat = $this->_getConn()->prepare('INSERT INTO tblusuario 
															(usu_nome,usu_email,usu_login,usu_senha,_usu_dataCadastro,usu_dataUltimoAcesso,per_id,usu_status)
															VALUES(:usu_nome,:usu_email,:usu_login,:usu_senha,NOW(),NOW(),:per_id,:usu_status)');
            $this->_stat->bindValue(':usu_nome', $objUsuario->getNome(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':usu_email', $objUsuario->getEmail(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':usu_login', $objUsuario->getLogin(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':usu_senha', $objUsuario->getSenha(), \PDO::PARAM_STR);
            $this->_stat->bindValue(':per_id', $objUsuario->getObjPerfil()->getId(), \PDO::PARAM_INT);
            $this->_stat->bindValue(':usu_status', $objUsuario->getStatus(), \PDO::PARAM_INT);
            $this->_stat->execute();
            return $this->_getConn->lastInsertId();
        } catch (\PDOException $e) {
            throw new \model\conexao\Excecao($e->getMessage());
        }
    }
예제 #10
0
 public function insert(Usuario $u)
 {
     if ($this->getUsuario($u->getLogin(), $u->getSenha()) == 0) {
         $i = $u->getId();
         $n = $u->getNome();
         $l = $u->getLogin();
         $s = $u->getSenha();
         $e = $u->getEmail();
         if ($stmt = $this->connection->prepare("Insert into `TB_Usuario` (`id_usuario`, `nm_usuario`, `ds_login`, `ds_senha`, `ds_email`) VALUES (?,?,?,?,?)")) {
             //  "sss" retpresenta 3 strings, se fosse  2 string e um interio  seria "ssd"
             $stmt->bind_param("issss", $i, $n, $l, $s, $e);
             $stmt->execute();
             $stmt->close();
             redirect("/painel/usuarios");
         } else {
             echo "<hr>";
             die($this->connection->error);
             echo "<hr>";
         }
     } else {
         echo "Usuario Ja Cadastrado";
     }
 }
예제 #11
0
?>

<?php 
require_once $_SESSION['DOCROOT'] . "/classes/class.usuario.php";
?>

 <span class="titusr">Prêmio Opaleiro do Ano</span>

<?php 
include "traco.php";
$usr = new Usuario($_GET['usr']);
$crt = $_GET['crt'];
?>
	
<span class="titusr">Pontos <?php 
echo $usr->getNome();
?>
</span>
  <table  id="tabform" style="width:100%;">

  <?php 
$lst = $usr->getPontos($crt);
if (count($lst) == 0) {
    include "volta.php";
    echo "</table>";
    include "rodape.php";
    return;
}
$cor = 0;
$vez = 0;
foreach ($lst as $u) {
예제 #12
0
 </head> 
 
 <title>Self</title> 
 
 <body  data-speed="10" class="bg-Parallax">
 <div id="transparente-div-home" class="fontebase"> 
 


        <table class="table_header" width="100%"  height="60px" border="0" >
        <td align="center" valign="top" class=""> 
            <span class="boas-vindas"><a href="<?php 
echo ROOT_URL;
?>
"> Ol&aacute; <?php 
echo $usuario->getNome();
?>
 
                 =)</a>
            </span>

            <span class="align-right" align="center" valign="top"> 
                <span class="align-right" align="right" style="padding-top:5px" >
                    <?php 
include ROOT . 'view/inc/todasturmas.php';
?>
                </span>
                
                
            <br>
            <div id="menu">
 function toRecordSet(Usuario $usuario)
 {
     return array($usuario->getId(), $usuario->getUsuario(), $usuario->getSenha(), $usuario->getNome(), $usuario->getEmail(), $usuario->getNivel(), $usuario->getEmpresa()->getId());
 }
예제 #14
0
 public function salvar(Usuario $obj)
 {
     $strSQL = "INSERT INTO CAD_USU_USUARIOS(";
     $strSQL .= "GRU_ID, USU_Nome, USU_Login, ";
     $strSQL .= "USU_Senha, USU_Email, ";
     $strSQL .= "USU_Telefone, USU_DataHoraCadastro, ";
     $strSQL .= "USU_Status";
     $strSQL .= ")VALUES (" . $obj->getGrupo()->getId() . ", '" . $obj->getNome() . "', '" . $obj->getLogin() . "', ";
     $strSQL .= "'" . $obj->getSenha() . "', '" . $obj->getEmail() . "', ";
     $strSQL .= "'" . $obj->getTelefone() . "', '" . $obj->getDataHoraCadastro() . "', ";
     $strSQL .= "'" . $obj->getStatus() . "'";
     $strSQL .= ")";
     return Db::getInstance()->executar($strSQL);
 }
예제 #15
0
 public function save(Usuario $usuario)
 {
     $sql = "insert into biblioteca values(?,?,?,?)";
     $stm = ConexaoMysql::getInstance()->prepare($sql);
     $stm->execute(array($usuario->getId(), $usuario->getCpf(), $usuario->getNome()));
 }
예제 #16
0
 public function insertUsuario(Usuario $usuario)
 {
     $sql = "INSERT into usuario (nome, email, usuario, senha, foto)\n            VALUES ('" . $usuario->getNome() . "','" . $usuario->getEmail() . "','" . $usuario->getLogin() . "' ,'" . $usuario->getSenha() . "', '" . $usuario->getFoto() . "')";
     $this->sqlExec($sql);
 }
예제 #17
0
<div id="menuadm">
<a href="opaleirodoano.php" target="_blank"><b>»»REGULAMENTO</b></a>
</div>

  <table  id="tabform" style="width:100%;">
  <tr> <td colspan="2" align="center"><b>>> C L A S S I F I C A Ç Ã O <<</b></td></tr>
  <tr  class="cabec"><td>Membro</td><td align="center">Pontos</td></tr>
  <?php 
$lst = Usuario::getRanking();
if (count($lst) == 0) {
    return;
}
$cor = 0;
$pos = 0;
foreach ($lst as $u) {
    $usr = new Usuario($u['userid']);
    $i = sprintf('<a href="lst_pontos.php?usr=%d&crt=0">', $u['userid']);
    $pos++;
    $linha = sprintf("<td>%dº-%s%s</a></td><td align=center>%s%d</a></td>", $pos, $i, $usr->getNome(), $i, $u['pontos']);
    if ($cor == 0) {
        $cor = 1;
        echo '<tr class="rel1">' . $linha . '</tr>' . "\n";
    } else {
        $cor = 0;
        echo '<tr class="rel2">' . $linha . '</tr>' . "\n";
    }
}
?>
  </table>
<?php 
include "rodape.php";
예제 #18
0
 public function atualizar(Usuario $usuario)
 {
     try {
         $sql = "UPDATE usuario SET " . "nome = :nome," . "cpf = :cpf," . "email = :email," . "telefone = :telefone," . "senha = :senha," . "liberado = :liberado," . "tipo = :tipo," . "qtdResponde = :qtdResponde," . "status = :status," . "idCurso = :idCurso " . "WHERE id = :id";
         $p_sql = $this->pdo->prepare($sql);
         $p_sql->bindValue(":id", $usuario->getId());
         $p_sql->bindValue(":nome", $usuario->getNome());
         $p_sql->bindValue(":cpf", $usuario->getCpf());
         $p_sql->bindValue(":email", $usuario->getEmail());
         $p_sql->bindValue(":telefone", $usuario->getTelefone());
         $p_sql->bindValue(":senha", $usuario->getSenha());
         $p_sql->bindValue(":liberado", $usuario->getLiberado());
         $p_sql->bindValue(":tipo", $usuario->getTipo());
         $p_sql->bindValue(":qtdResponde", $usuario->getQtdResponde());
         $p_sql->bindValue(":status", $usuario->getStatus());
         $p_sql->bindValue(":idCurso", $usuario->getIdCurso());
         return $p_sql->execute();
     } catch (Exception $e) {
         print "Ocorreu um erro ao tentar executar esta ação, foi gerado um LOG do mesmo, tente novamente mais tarde.";
     }
 }
예제 #19
0
<?php

include "sessao.php";
include "head.php";
require_once $_SESSION['DOCROOT'] . "/classes/class.usuario.php";
$u = $_GET['usr'];
$usr = new Usuario($u);
echo '<span class="titusr">Membro: ' . $usr->getNome() . '</span>';
include "traco.php";
?>
  <table  id="detmembro">
  <tr style="font-weight:bold;"><td width="100px">E-mail:</td><td width="350px"><?php 
echo $usr->getEmail();
?>
 </td></tr>
  <tr style="font-weight:bold;"><td>Cidade:</td><td> <?php 
echo $usr->getCidade() . "/" . $usr->getEstado();
?>
</td></tr>
  <tr style="font-weight:bold;"><td>Ano:</td><td> <?php 
echo $usr->getAnoOpala();
?>
</td></tr>
  <tr style="font-weight:bold;"><td colspan=2>Descrição:</td></tr>
  <tr style="font-weight:bold;"><td colspan=2 style="border:1px; border-style:solid; border-color:#000099;"><?php 
echo $usr->getDescricao();
?>
</td></tr>
  <tr style="font-weight:bold;"><td colspan=2>Fotos:</td></tr>
  <?php 
$pasta = sprintf("./pics/U%06d/", $u);
예제 #20
0
파일: perfil.php 프로젝트: marcosyyz/dm
<?php

include '../../config.php';
include ROOT . 'model/Usuario.php';
include ROOT . 'model/SEO.php';
$usuario_cdg = isset($_GET['u']) ? $_GET['u'] : -1;
$usuario_cdg = $usuario_cdg == -1 ? $_SESSION['USUARIO_CDG'] : $usuario_cdg;
$Usuario = new Usuario($usuario_cdg);
$SEO = new SEO();
$SEO->setTitle('Perfil - ' . $Usuario->getNome());
include ROOT . 'view/cadastro/perfil.php';
 /**
  * atualiza um registro da tabela
  *
  * @parametro UsuarioMySql usuario
  */
 public function update(Usuario $Usuario)
 {
     $sql = "UPDATE {$this->table} SET nome = :nome, email = :email WHERE id_usuario = :id";
     $stmt = ConnectionFactory::prepare($sql);
     $id = $Usuario->getIdUsuario();
     $nome = $Usuario->getNome();
     $email = $Usuario->getEmail();
     $stmt->bindParam(':id', $id);
     $stmt->bindParam(':nome', $nome);
     $stmt->bindParam(':email', $email);
     return $stmt->execute();
 }