public function login()
 {
     $mail = isset($_POST['user_mail']) ? $_POST['user_mail'] : '';
     $password = isset($_POST['user_password']) ? encript_password($_POST['user_password']) : '';
     $data = $this->model('LoginModel');
     $result = $data->login_users($this->tableUsers, $mail, $password);
     url_redirect($result);
 }
 private function key_is_ok($datos)
 {
     extract($datos);
     $fecha = date('Y-m-d');
     $key2 = encript_password('deletecat-' . $id . '-&' . $fecha);
     if ($key == $key2) {
         $this->delete_user($id);
     } else {
         $result = site_url() . 'admin/categorias/?code=7';
         url_redirect($result);
     }
 }
Пример #3
0
 public function save($datos)
 {
     extract($datos);
     try {
         $fecha = date('Y-m-d');
         $password = encript_password($password);
         $query = $this->dbh->prepare('INSERT INTO ac_users (first_name, last_name, email, password, created_at, type) VALUES (:nombre,:apellido,:email,:password,:fecha,:type)');
         $query->bindParam(":nombre", $first_name, PDO::PARAM_STR);
         $query->bindParam(":apellido", $last_name, PDO::PARAM_STR);
         $query->bindParam(":email", $email, PDO::PARAM_STR);
         $query->bindParam(":password", $password, PDO::PARAM_STR);
         $query->bindParam(":fecha", $fecha, PDO::PARAM_STR);
         $query->bindParam(":type", $type, PDO::PARAM_INT);
         $op = $query->execute();
         return site_url() . 'admin/usuarios/?exito=1';
     } catch (PDOException $e) {
         return site_url() . 'admin/usuarios/?exito=0';
     }
 }
Пример #4
0
/**	
 * ARMA LA URL PARA ELIMINAR UNA CATEGORIA
 */
function link_delete_post($post_id)
{
    $fecha = date('Y-m-d');
    $key = encript_password('deletepost-' . $post_id . '-&' . $fecha);
    return site_url() . 'admin/post/delete/?id=' . $post_id . '&key=' . $key;
}
 public function editPassword($datos)
 {
     extract($datos);
     if ($password == $repit_password) {
         $password = encript_password($password);
         $data = $this->model('UsersModel');
         $result = $data->updatePassword($id_usuario, $password);
         if ($result) {
             $result = site_url() . 'admin/usuario/' . $id_usuario . '/?exito=4';
             url_redirect($result);
         }
     }
 }