| Server IP : 84.32.84.242 / Your IP :
216.73.216.109 [
Web Server : LiteSpeed System : Linux nl-srv-web1124.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : u964240598 ( 964240598) PHP Version : 8.4.19 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u964240598/domains/hofam.org/public_html/churchapp/application/controllers/ |
Upload File : |
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : User (UserController)
* User Class to control all user related operations
*/
class User extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
$this->isLoggedIn();
}
public function index()
{
$data['userRecords'] = $this->user_model->userListing();
$this->load->template('admin/listing', $data); // this will load the view file
}
public function logout(){
$this->session->unset_userdata('email');
$this->session->unset_userdata('isLoggedIn');
//$this->session->sess_destroy();
// Redirect to index page
redirect ( 'login' );
}
public function newAdmin()
{
$this->load->template('admin/new', []); // this will load the view file
}
public function editAdmin($id=0)
{
$data['admin'] = $this->user_model->getAdminInfo($id);
if(count((array)$data['admin'])==0)
{
redirect('adminListing');
}
$this->load->template('admin/edit', $data); // this will load the view file
}
function savenewadmin()
{
$this->load->library('session');
$this->load->library('form_validation');
$this->form_validation->set_rules('name','Full Name','trim|required|max_length[128]|xss_clean');
$this->form_validation->set_rules('email','Email','trim|required|xss_clean|max_length[128]');
$this->form_validation->set_rules('password1','Password','required|max_length[20]');
$this->form_validation->set_rules('password2','Confirm Password','trim|required|matches[password1]|max_length[20]');
if($this->form_validation->run() == FALSE)
{
redirect('newAdmin');
}
else
{
$name = ucwords(strtolower($this->input->post('name')));
$email = $this->input->post('email');
$password = $this->input->post('password1');
$userInfo = array(
'fullname' => $name,
'email' => $email,
'password' => getHashedPassword($password)
);
$this->user_model->addNewAdmin($userInfo);
if($this->user_model->status == "ok")
{
$this->session->set_flashdata('success', $this->user_model->message);
}
else
{
$this->session->set_flashdata('error', $this->user_model->message);
}
redirect('newAdmin');
}
}
function editadmindata()
{
$this->load->library('session');
$this->load->library('form_validation');
$id = $this->input->post('id');
$this->form_validation->set_rules('name','Full Name','trim|required|max_length[128]|xss_clean');
$this->form_validation->set_rules('email','Email','trim|required|xss_clean|max_length[128]');
if($this->input->post('password1') != ''){
$this->form_validation->set_rules('password1','Password','required|max_length[20]');
$this->form_validation->set_rules('password2','Confirm Password','trim|required|matches[password1]|max_length[20]');
}
if($this->form_validation->run() == FALSE)
{
redirect('editAdmin/'.$id);
}
else
{
$name = ucwords(strtolower($this->input->post('name')));
$email = $this->input->post('email');
$password = $this->input->post('password1');
$userInfo = array(
'fullname' => $name,
'email' => $email
);
if($password!=''){
$userInfo['password'] = getHashedPassword($password);
}
$this->user_model->editAdmin($userInfo,$id);
if($this->user_model->status == "ok")
{
$this->session->set_flashdata('success', $this->user_model->message);
}
else
{
$this->session->set_flashdata('error', $this->user_model->message);
}
redirect('editAdmin/'.$id);
}
}
function deleteAdmin($id=0)
{
$this->load->library('session');
$this->user_model->deleteAdmin($id);
if($this->user_model->status == "ok")
{
$this->session->set_flashdata('success', $this->user_model->message);
}
else
{
$this->session->set_flashdata('error', $this->user_model->message);
}
redirect('adminListing');
}
}
?>
Anon7 - 2022
AnonSec Team
