function manage_profile($param1 = '', $param2 = '', $param3 = '') { /*if ($this->session->userdata('admin_login') != 1) redirect(base_url() . 'admin/login', 'refresh'); $page_data['page_name'] = 'manage_profile'; $page_data['page_title'] = 'Manage Profile'; $this->load->view('admin/index',$page_data);*/ if ($this->session->userdata('admin_login') != 1) { redirect(base_url() . 'admin/login', 'refresh'); } if ($param1 == 'update_profile_info') { $data['uname'] = $this->input->post('name'); $data['emailid'] = $this->input->post('email'); $this->db->where('manage_id', $this->session->userdata('manage_id')); $this->db->update('site_management_users', $data); $this->session->set_flashdata('flash_message', 'Account Updated'); redirect(base_url() . 'admin/manage_profile/', 'refresh'); } if ($param1 == 'change_password') { $data['password'] = _base64_encrypt($this->input->post('password'), 'bytes789'); $data['new_password'] = $this->input->post('new_password'); $data['confirm_new_password'] = $this->input->post('confirm_new_password'); $data['pass'] = _base64_encrypt($data['new_password'], 'bytes789'); $current_password = $this->db->get_where('site_management_users', array('manage_id' => $this->session->userdata('manage_id')))->row()->password; if ($current_password == $data['password'] && $data['new_password'] == $data['confirm_new_password']) { $this->db->where('manage_id', $this->session->userdata('manage_id')); $this->db->update('site_management_users', array('password' => $data['pass'])); $this->session->set_flashdata('flash_message', 'Password Updated'); } else { $this->session->set_flashdata('flash_message', 'Password Mismatch'); } redirect(base_url() . 'admin/manage_profile/', 'refresh'); } $page_data['page_name'] = 'manage_profile'; $page_data['page_title'] = 'Manage Profile'; $page_data['edit_data'] = $this->db->get_where('site_management_users', array('manage_id' => $this->session->userdata('manage_id')))->result_array(); $this->load->view('admin/index', $page_data); }
function changepassword($param1 = '', $param2 = '') { if ($this->session->userdata('user_login') != 1) { redirect(base_url() . 'home/login', 'refresh'); } if ($param1 == 'update_pass') { $old_pass = _base64_encrypt($this->input->post('old_pass'), 'bytes789'); $new_pass_en = _base64_encrypt($this->input->post('new_pass'), 'bytes789'); $new_pass = $this->input->post('new_pass'); $confirm_pass = $this->input->post('confirm_pass'); if ($new_pass == $confirm_pass) { $output = $this->db->query("SELECT * FROM `users` WHERE `user_id`=" . $param2)->row()->password; if ($output == $old_pass) { if ($output != $new_pass_en) { $data['password'] = $new_pass_en; $this->db->where('user_id', $param2); $this->db->update('users', $data); $this->session->set_flashdata('flash_message', 'Password Changed!'); redirect(base_url() . 'home/changepassword/', 'refresh'); } else { $this->session->set_flashdata('flash_message', 'Error : Password Mismatch!'); redirect(base_url() . 'home/changepassword/', 'refresh'); } } else { $this->session->set_flashdata('flash_message', 'Error : Password Mismatch!'); redirect(base_url() . 'home/changepassword/', 'refresh'); } } else { $this->session->set_flashdata('flash_message', 'Error : Password Mismatch!'); redirect(base_url() . 'home/changepassword/', 'refresh'); } } $page_data['head'] = 'dash_header.php'; $page_data['foot'] = 'dash_footer.php'; $page_data['page_name'] = 'changepassword'; $this->load->view('static/index', $page_data); }
function do_install() { $db_verify = 1; $purchase_verify = 1; if ($purchase_verify == true && $db_verify == true) { // Replace the database settings $data = read_file('./application/config/database.php'); $data = str_replace('db_name', $this->input->post('db_name'), $data); $data = str_replace('db_uname', $this->input->post('db_uname'), $data); $data = str_replace('db_password', $this->input->post('db_password'), $data); $data = str_replace('db_hname', $this->input->post('db_hname'), $data); write_file('./application/config/database.php', $data); // Replace new default routing controller $data2 = read_file('./application/config/routes.php'); $data2 = str_replace('install', 'home', $data2); write_file('./application/config/routes.php', $data2); // Run the installer sql schema $this->load->database(); $schema = read_file('./uploads/database.sql'); $query = rtrim(trim($schema), "\n;"); $query_list = explode(";", $query); foreach ($query_list as $query) { $this->db->query($query); } // Replace the admin login credentials $pass = _base64_encrypt($this->input->post('password'), 'bytes789'); $this->db->where('manage_id', 1); $this->db->update('site_management_users', array('admintype' => '1', 'uname' => $this->input->post('ad_name'), 'emailid' => $this->input->post('email'), 'password' => $pass, 'status' => '1')); // Replace the system name $this->db->where('type', 'site_name'); $this->db->update('sitesettings', array('description' => $this->input->post('system_name'))); // Replace the system title $this->db->where('type', 'site_name'); $this->db->update('sitesettings', array('description' => $this->input->post('system_name'))); // Replace the system keywords $this->db->where('type', 'site_keywords'); $this->db->update('sitesettings', array('description' => $this->input->post('system_keyword'))); // Replace the system description $this->db->where('type', 'site_description'); $this->db->update('sitesettings', array('description' => $this->input->post('system_description'))); /* // Replace the system logo $path=@$_FILES['site_logo']['name']; if(!empty($path)){ $filename='logo.png'; $moved = move_uploaded_file($_FILES['site_logo']['tmp_name'], 'uploads/'.$filename ); if( $moved ) { $this->db->where('type', 'site_logo'); $this->db->update('sitesettings', array('description' => $filename )); } else { $this->session->set_flashdata('flash_message','upload Failed'); redirect(base_url().'install' , 'refresh'); } } */ // Redirect to dashboard page after completing installation $this->session->set_userdata('admin_login', '1'); $this->session->set_userdata('admintype', '1'); $this->session->set_userdata('manage_id', '1'); $this->session->set_userdata('uname', $this->input->post('ad_name')); $this->session->set_userdata('status', '1'); $this->session->set_flashdata('installation_result', 'Successfully Installed'); redirect(base_url() . 'admin/dashboard', 'refresh'); } else { $this->session->set_flashdata('installation_result', 'failed'); redirect(base_url() . 'install', 'refresh'); } }