Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function Registrar(){
- try{
- if(!empty($_POST['email']) and !empty($_POST['pass'])){
- $db = new Conexion();
- $this->email = $db->real_escape_string($_POST['email']);
- $this->pass = $this->Encrypt($_POST['pass']);
- $sql = $db->query("SELECT email FROM users WHERE email='$this->email';");
- if($db->rows($sql) == 0){
- echo 1;
- $online = time() + (60*5);
- $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', '', '');");
- $sql3 = $db->query("SELECT MAX(id_user) AS is_user FROM users;");
- $id_user = $db->recorrer($sql3);
- $_SESSION['id_user'] = $id_user[0];
- $_SESSION['email'] = $this->email;
- $_SESSION['admin'] = 0;
- echo 1;
- $db->liberar($sql2,$sql3);
- }else{
- $datos = $db->recorrer($sql);
- if(strtolower($this->email) == strtolower($datos['email'])){
- throw new Exception(2);
- }
- }
- $db->liberar($sql,$sql2,$sql3);
- $db->close();
- }else{
- throw new Exception('ERROR: Datos Vacios.');
- }
- }catch(Exception $reg){
- echo $reg->getMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement