Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!defined('BASEPATH')) exit('No direct script access allowed');
- class Registro_model extends CI_Model {
- public function __construct() {
- parent::__construct();
- }
- public function set_usuario($nombre, $correo, $contrasena, $fecha){
- $data = array(
- 'USU_NOMBRE' => $nombre,
- 'USU_CORREO' => $correo,
- 'USU_CONTRASENA' => $contrasena,
- 'USU_NACIMIENTO' => $fecha
- );
- return $this->db->insert('usuarios', $data);
- }
- public function set_token($correo, $token) {
- $data = array(
- 'USU_verificationToken' => $token
- );
- $this->db->where('USU_CORREO', $correo);
- $query = $this->db->update('usuarios', $data);
- return $query;
- }
- public function verify_token($token) {
- $this->db->where('USU_verificationToken', $token);
- $query = $this->db->get('usuarios');
- return ($query->num_rows > 0 ? true : false);
- }
- public function update_password($token, $nuevaContrasena) {
- $data = array(
- 'USU_CONTRASENA' => $nuevaContrasena
- );
- $this->db->where('USU_verificationToken', $token);
- $query = $this->db->update('usuarios, $data);
- return $query;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement