49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
|
<?php
|
||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
class ResetpassPemilik 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('dashboard'));
|
||
|
}
|
||
|
|
||
|
$get = $this->input->get();
|
||
|
if($get['id_user']==NULL){
|
||
|
redirect(site_url('admin/dashboard'));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function index()
|
||
|
{
|
||
|
|
||
|
$get = $this->input->get();
|
||
|
$pemilik = $this->UserModel->getUsersById($get['id_user']);
|
||
|
|
||
|
if($this->input->post()){
|
||
|
|
||
|
if($this->UserModel->resetPassword($pemilik->id_user)){
|
||
|
redirect(site_url('admin/resetpasspemilik?id_user='.$pemilik->id_user.'&msg=success'));
|
||
|
} else {
|
||
|
$data['msg']="error!";
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
$data['pemilik'] = $pemilik;
|
||
|
$data['user_logged'] = $this->session->userdata('user_logged');
|
||
|
$this->load->view('admin/resetpasspemilik',$data);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|