Advertisement
Guest User

Untitled

a guest
Jan 27th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. public function Registrar(){
  2. try{
  3. if(!empty($_POST['email']) and !empty($_POST['pass'])){
  4. $db = new Conexion();
  5. $this->email = $db->real_escape_string($_POST['email']);
  6. $this->pass = $this->Encrypt($_POST['pass']);
  7.  
  8. $sql = $db->query("SELECT email FROM users WHERE email='$this->email';");
  9.  
  10. if($db->rows($sql) == 0){
  11. echo 1;
  12. $online = time() + (60*5);
  13. $sql2 = $db->query("INSERT INTO users (`email`, `pass`, `nombre`, `apellido`, `sexo`, `fechan`, `pais`, `ciudad`, `telefono`, `descripcion`, `ext`, `admin`, `cambio`, `online`) VALUES ('$this->email', '$this->pass', '', '', '', '', '', '', '', '', 'jpg', '0', '', '');");
  14. $sql3 = $db->query("SELECT MAX(id_user) AS is_user FROM users;");
  15. $id_user = $db->recorrer($sql3);
  16. $_SESSION['id_user'] = $id_user[0];
  17. $_SESSION['email'] = $this->email;
  18. $_SESSION['admin'] = 0;
  19. echo 1;
  20. $db->liberar($sql2,$sql3);
  21. }else{
  22. $datos = $db->recorrer($sql);
  23. if(strtolower($this->email) == strtolower($datos['email'])){
  24. throw new Exception(2);
  25. }
  26. }
  27. $db->liberar($sql,$sql2,$sql3);
  28. $db->close();
  29.  
  30. }else{
  31. throw new Exception('ERROR: Datos Vacios.');
  32. }
  33.  
  34. }catch(Exception $reg){
  35. echo $reg->getMessage();
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement