39 lines
763 B
PHP
39 lines
763 B
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Setting extends CI_Controller {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model("UserModel");
|
|
|
|
if($this->UserModel->isNotLogin()) {
|
|
redirect(site_url('login'));
|
|
} elseif(!($this->UserModel->isAdmin())) {
|
|
redirect(site_url('user/dashboard'));
|
|
}
|
|
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$data['user_logged'] = $this->session->userdata('user_logged');
|
|
|
|
if($this->input->post()){
|
|
|
|
if($this->UserModel->resetPassword($data['user_logged']->id_user)){
|
|
redirect(site_url('admin/setting?&msg=success'));
|
|
} else {
|
|
$data['msg']="error!";
|
|
}
|
|
|
|
}
|
|
|
|
$this->load->view('admin/setting',$data);
|
|
|
|
}
|
|
|
|
|
|
}
|