Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('Conexao.php');
- include_once('Endereco.php');
- include_once('Cartao_Credito.php');
- include_once('../Helpers/Helpers.php');
- abstract class Usuario {
- private $Nome;
- private $Senha;
- private $Email;
- private $Telefone;
- private $NumeroParticipante;
- private $TipoUsuario;
- public function __construct()
- {
- $this->con = new Conexao();
- $this->Endereco = new Endereco();
- $this->Cartao_Credito = new Cartao_Credito();
- }
- public function __set($nome, $valor)
- {
- $this->$nome = $valor;
- }
- public function __get($nome)
- {
- return $this->$nome;
- }
- public function queryAddUsuario($dados)
- {
- try {
- $this->Nome = $dados['Nome'];
- $this->Senha = md5($dados['Senha']);
- $this->Email = $dados['Email'];
- $this->Telefone = $dados['Telefone'];
- $this->NumeroParticipante = $dados['NumeroParticipante'];
- $this->TipoUsuario = $dados['TipoUsuario'];
- $values = $this->con->Conectar()->prepare("INSERT INTO usuario ('nome','senha','email','telefone','numero_participante','tipo_usuario')
- VALUES (:nome,:senha,:email,:telefone,:numero_participante,:tipo_usuario);");
- $values->bindParam(":nome",$this->Nome, PDO::PARAM_STR);
- $values->bindParam(":senha",$this->Senha, PDO::PARAM_STR);
- $values->bindParam(":email",$this->Email, PDO::PARAM_STR);
- $values->bindParam(":telefone",$this->Telefone, PDO::PARAM_STR);
- $values->bindParam(":numero_participante",$this->NumeroParticipante, PDO::PARAM_STR);
- $values->bindParam(":tipo_usuario",$this->TipoParticipante, PDO::PARAM_STR);
- if ($values->execute())
- return 'ok';
- else
- return 'erro';
- } catch (PDOException $e) {
- return 'error '.$e->getMessage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement