Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test extends CI_Controller {
- public $user_session;
- public function __construct()
- {
- parent::__construct();
- $this->load->model('Admin_Model');
- }
- //////////////////////////////////////ACCOUNT NAVBAR//////////////////////////////////////
- public function account_nav($username = "")
- {
- if(is_logged_in() && $username != ""){
- $acc_nav = $this->Admin_Model->account($username);
- return $acc_nav;
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- //////////////////////////////////////ACCOUNT NAVBAR//////////////////////////////////////
- public function index()
- {
- if(is_logged_in()){
- $push_notification = $this->Admin_Model->push_notification();
- $get_number_user = $this->Admin_Model->get_number_user();
- $get_number_deal = $this->Admin_Model->get_number_deal();
- $get_number_card = $this->Admin_Model->get_number_card();
- $get_total_cash = $this->Admin_Model->get_total_cash();
- $data = array(
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- "get_number_user"=>$get_number_user,
- "get_number_deal"=>$get_number_deal,
- 'get_number_card'=>$get_number_card,
- 'get_total_cash'=>$get_total_cash,
- 'push_notification'=>$push_notification,
- );
- $this->load->view('admin/index',$data);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- //////////////////////////////////////UPLOAD//////////////////////////////////////
- public function upload()
- {
- $this->load->view('upload_f', array('error' => ' ' ));
- }
- public function do_upload($files_input)
- {
- // $config['upload_path'] = './uploads/';
- // $config['allowed_types'] = 'gif|jpg|png';
- // $config['max_size'] = 1024*20;
- // $config['max_width'] = 1024;
- // $config['max_height'] = 768;
- // $config['encrypt_name'] = TRUE;
- // $this->load->library('upload', $config);
- // if ( ! $this->upload->do_upload('userfile'))
- // {
- // $error = array('error' => $this->upload->display_errors());
- // $this->load->view('upload_f', $error);
- // }
- // else
- // {
- // $data = array('upload_data' => $this->upload->data());
- // $this->load->view('upload_s', $data);
- // }
- if(!empty($_FILES[$files_input]['name'])){
- $filesCount = count($_FILES[$files_input]['name']);
- for($i = 0; $i < $filesCount; $i++){
- $_FILES[$files_input."s"]['name'] = $_FILES[$files_input]['name'][$i];
- $_FILES[$files_input."s"]['type'] = $_FILES[$files_input]['type'][$i];
- $_FILES[$files_input."s"]['tmp_name'] = $_FILES[$files_input]['tmp_name'][$i];
- $_FILES[$files_input."s"]['error'] = $_FILES[$files_input]['error'][$i];
- $_FILES[$files_input."s"]['size'] = $_FILES[$files_input]['size'][$i];
- // File upload configuration
- $uploadPath = './uploads/';
- $config['upload_path'] = $uploadPath;
- $config['allowed_types'] = 'jpg|jpeg|png|gif';
- $config['max_size'] = 1024*30;
- // $config['max_width'] = 1024;
- // $config['max_height'] = 768;
- $config['encrypt_name'] = TRUE;
- // Load and initialize upload library
- $this->load->library('upload', $config);
- $this->upload->initialize($config);
- // Upload file to server
- if($this->upload->do_upload($files_input."s")){
- // Uploaded file data
- $fileData = $this->upload->data();
- $uploadData[$i]['file_name'] = $fileData['file_name'];
- }
- }
- $data_out = array();
- $data_final = array();
- if(isset($uploadData)){
- for($i = 0; $i < $filesCount; $i++){
- if(isset($uploadData[$i])){
- array_push($data_out, $uploadData[$i]['file_name']);
- }
- }
- }
- if($data_out != NULL){
- $data_final[$files_input] = json_encode($data_out);
- }
- else
- {
- $data_final[$files_input] = "";
- }
- // $uploadData[$i]["file_name"];
- return $data_final[$files_input];
- }
- else
- {
- return "";
- }
- }
- //////////////////////////////////////UPLOAD//////////////////////////////////////
- /////////////////////////////////////LOGIN SIGNUP////////////////////////////////
- public function register()
- {
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = array(
- "csrf"=>$csrf
- );
- if(is_logged_in()){
- $this->load->view('admin/register',$data);
- }
- else
- {
- header("Location:".base_url()."admin");
- }
- }
- public function register_process()
- {
- if(is_logged_in()){
- $email = $this->input->post('email');
- $username = $this->input->post('username');
- $password = md5($this->input->post('password'));
- if($this->Admin_Model->register($email,$username,$password) != 200){
- $array = array(
- 'register_new_admin' => $username
- );
- $this->session->set_userdata( $array );
- header("Location:".base_url()."admin/register");
- }
- else
- {
- echo "Error: User or Email has been exist !";
- }
- }
- else
- {
- header("Location:".base_url()."admin");
- }
- }
- public function login()
- {
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = array(
- "csrf"=>$csrf
- );
- if(!is_logged_in()){
- $this->load->view('admin/login',$data);
- }
- else
- {
- header("Location:".base_url()."admin");
- }
- }
- public function login_process(){
- if(!is_logged_in()){
- $emailuser_get = $this->input->post('emailorusername');
- $password_get = md5($this->input->post('password'));
- $data = $this->Admin_Model->login($emailuser_get,$password_get);
- if($data == NULL){
- echo "Failed";
- $_SESSION["admin_login"] = "";
- $_SESSION["admin_login_ok"] = 0;
- }
- else
- {
- $_SESSION["admin_login"] = $data[0]['usrname'];
- $_SESSION["admin_login_ok"] = 1;
- header("Location:".base_url()."admin");
- }
- // if(($emailuser_get == $data[0]["usrname"] || $emailuser_get == $data[0]["email"]) && md5($password_get) == $data[0]["passwd"]){
- // $_SESSION["admin_login"] = $data[0]['usrname'];
- // $_SESSION["admin_login_ok"] = 1;
- // header("Location:".base_url()."admin");
- // }
- // else
- // {
- // echo "Failed";
- // $_SESSION["admin_login"] = "";
- // $_SESSION["admin_login_ok"] = 0;
- // }
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function logout()
- {
- $_SESSION["admin_login"] = "";
- $_SESSION["admin_login_ok"] = 0;
- header("Location:".base_url()."admin");
- }
- ////////////////////////////////SHOP////////////////////////////////
- public function shop($game_type = "")
- {
- if(is_logged_in() && is_admin()){
- $data = $this->Admin_Model->shop($game_type);
- $data = array(
- "data"=>$data,
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- );
- $this->load->view('admin/shop/index', $data, FALSE);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function add_shop()
- {
- if(is_logged_in() && is_admin()){
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = $this->Admin_Model->game();
- $data = array(
- "data"=>$data,
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- 'csrf'=>$csrf
- );
- $this->load->view('admin/shop/add_shop',$data);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function add_shop_process()
- {
- if(is_logged_in() && is_admin()){
- $game_type = $this->input->post('game_type');
- $user_acc = $this->input->post('username');
- $id_acc = substr(md5($user_acc), 0,10).rand(1000,9999);
- $pass_acc = $this->input->post('password');
- $more_info_acc = $this->input->post('more_info_acc');
- if($game_type == "lienquan"){
- $sotuong = $this->input->post('sotuong');
- $trangphuc = $this->input->post('trangphuc');
- $bangngoc = $this->input->post('bangngoc');
- $bacngoc = $this->input->post('bacngoc');
- $rank = $this->input->post('rank');
- $vang = $this->input->post('vang');
- $ruby = $this->input->post('ruby');
- $quanhuy = $this->input->post('quanhuy');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "sotuong"=>$sotuong,
- "trangphuc"=>$trangphuc,
- "bangngoc"=>$bangngoc,
- "bacngoc"=>$bacngoc,
- "rank"=>$rank,
- "vang"=>$vang,
- "ruby"=>$ruby,
- "quanhuy"=>$quanhuy,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "lienminh"){
- $sotuong = $this->input->post('sotuong');
- $trangphuc = $this->input->post('trangphuc');
- $bangngoc = $this->input->post('bangngoc');
- $bacngoc = $this->input->post('bacngoc');
- $ip = $this->input->post('ip');
- $rank = $this->input->post('rank');
- $khung = $this->input->post('khung');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "sotuong"=>$sotuong,
- "trangphuc"=>$trangphuc,
- "bangngoc"=>$bangngoc,
- "bacngoc"=>$bacngoc,
- "ip"=>$ip,
- "rank"=>$rank,
- "khung"=>$khung,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "ngocrong"){
- $hanhtinh = $this->input->post('hanhtinh');
- $server = $this->input->post('server');
- $dangki = $this->input->post('dangki');
- $bongtai = $this->input->post('bongtai');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "hanhtinh"=>$hanhtinh,
- "server"=>$server,
- "dangki"=>$dangki,
- "bongtai"=>$bongtai,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "ninja"){
- $capdo = $this->input->post('capdo');
- $server = $this->input->post('server');
- $class = $this->input->post('class');
- $ttgt = $this->input->post('ttgt');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "capdo"=>$capdo,
- "server"=>$server,
- "class"=>$class,
- "ttgt"=>$ttgt,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- // $image_acc = $this->input->post('image_acc');
- // if($image_acc != NULL){
- // $image_acc = explode("\n", $image_acc);
- // $image_array = array();
- // foreach ($image_acc as $key => $value) {
- // array_push($image_array, $value);
- // }
- // $image_array = json_encode($image_array);
- // }
- $tuong = 'tuong';
- $trangphuc = 'trangphuc';
- $bangngoc = 'bangngoc';
- $anhchung ='anhchung';
- // $image_tuong = ""; $image_trangphuc = ""; $image_ngoc = ""; $image_anhchung = "";
- $image_tuong = $this->do_upload($tuong);
- $image_trangphuc = $this->do_upload($trangphuc);
- $image_ngoc = $this->do_upload($bangngoc);
- $image_anhchung = $this->do_upload($anhchung);
- $cost_acc = $this->input->post('cost_acc');
- $status = 0;
- if($game_type != NULL && $user_acc != NULL && $id_acc != NULL && $pass_acc != NULL && $info_acc != NULL && $cost_acc != NULL){
- $this->Admin_Model->add_shop($id_acc,$game_type,$user_acc,$pass_acc,$more_info_acc,$info_acc,$image_tuong,$image_trangphuc,$image_ngoc,$image_anhchung,$cost_acc,$status);
- $_SESSION["them_thanh_cong_vao_shop"] = 1;
- header("Location:".base_url()."admin/add_shop");
- }
- else
- echo "Chua nhap du thong tin";
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function shop_detail($id_acc = ""){
- if(is_logged_in() && is_admin()){
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = $this->Admin_Model->shop_detail($id_acc);
- $data = array(
- "data"=>$data,
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- "csrf"=>$csrf,
- );
- $this->load->view('admin/shop/detail', $data, FALSE);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function shop_detail_process(){
- if(is_logged_in() && is_admin()){
- $game_type = $this->input->post('game_type');
- $user_acc = $this->input->post('username');
- $id_acc = $this->input->post('id_acc');
- $pass_acc = $this->input->post('password');
- $more_info_acc = $this->input->post('more_info_acc');
- if($game_type == "lienquan"){
- $sotuong = $this->input->post('sotuong');
- $trangphuc = $this->input->post('trangphuc');
- $bangngoc = $this->input->post('bangngoc');
- $bacngoc = $this->input->post('bacngoc');
- $rank = $this->input->post('rank');
- $vang = $this->input->post('vang');
- $ruby = $this->input->post('ruby');
- $quanhuy = $this->input->post('quanhuy');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "sotuong"=>$sotuong,
- "trangphuc"=>$trangphuc,
- "bangngoc"=>$bangngoc,
- "bacngoc"=>$bacngoc,
- "rank"=>$rank,
- "vang"=>$vang,
- "ruby"=>$ruby,
- "quanhuy"=>$quanhuy,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "lienminh"){
- $sotuong = $this->input->post('sotuong');
- $trangphuc = $this->input->post('trangphuc');
- $bangngoc = $this->input->post('bangngoc');
- $bacngoc = $this->input->post('bacngoc');
- $ip = $this->input->post('ip');
- $rank = $this->input->post('rank');
- $khung = $this->input->post('khung');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "sotuong"=>$sotuong,
- "trangphuc"=>$trangphuc,
- "bangngoc"=>$bangngoc,
- "bacngoc"=>$bacngoc,
- "ip"=>$ip,
- "rank"=>$rank,
- "khung"=>$khung,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "ngocrong"){
- $hanhtinh = $this->input->post('hanhtinh');
- $server = $this->input->post('server');
- $dangki = $this->input->post('dangki');
- $bongtai = $this->input->post('bongtai');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "hanhtinh"=>$hanhtinh,
- "server"=>$server,
- "dangki"=>$dangki,
- "bongtai"=>$bongtai,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- else if($game_type == "ninja"){
- $capdo = $this->input->post('capdo');
- $server = $this->input->post('server');
- $class = $this->input->post('class');
- $ttgt = $this->input->post('ttgt');
- $noibat = $this->input->post('noibat');
- $info_acc = array(
- "capdo"=>$capdo,
- "server"=>$server,
- "class"=>$class,
- "ttgt"=>$ttgt,
- "noibat"=>$noibat,
- );
- $info_acc = json_encode($info_acc);
- }
- $tuong = 'tuong';
- $trangphuc = 'trangphuc';
- $bangngoc = 'bangngoc';
- $anhchung ='anhchung';
- $image_tuong = $this->do_upload($tuong);
- $image_trangphuc = $this->do_upload($trangphuc);
- $image_ngoc = $this->do_upload($bangngoc);
- $image_anhchung = $this->do_upload($anhchung);
- if($image_tuong != NULL){
- $image_tuong = json_decode($this->do_upload($tuong));
- }
- if($image_trangphuc != NULL){
- $image_trangphuc = json_decode($this->do_upload($trangphuc));
- }
- if($image_ngoc != NULL){
- $image_ngoc = json_decode($this->do_upload($bangngoc));
- }
- if($image_anhchung != NULL){
- $image_anhchung = json_decode($this->do_upload($anhchung));
- }
- $db_img = $this->Admin_Model->shop_detail($id_acc);
- if($db_img[0]['image_tuong']){
- $db_img_tuong = json_decode($db_img[0]['image_tuong']);
- }
- else
- {
- $db_img_tuong = array();
- }
- if($db_img[0]['image_trangphuc']){
- $db_img_trangphuc = json_decode($db_img[0]['image_trangphuc']);
- }
- else
- {
- $db_img_trangphuc = array();
- }
- if($db_img[0]['image_ngochotro']){
- $db_img_ngoc = json_decode($db_img[0]['image_ngochotro']);
- }
- else
- {
- $db_img_ngoc = array();
- }
- if($db_img[0]['image_chung']){
- $db_img_anhchung = json_decode($db_img[0]['image_chung']);
- }
- else
- {
- $db_img_anhchung = array();
- }
- if($image_tuong != NULL){
- for($i=0;$i<count($image_tuong);$i++){
- array_push($db_img_tuong, $image_tuong[$i]);
- }
- $image_tuong = json_encode($db_img_tuong);
- }
- else
- {
- $image_tuong = $db_img[0]['image_tuong'];
- }
- if($image_trangphuc != NULL){
- for($i=0;$i<count($image_trangphuc);$i++){
- array_push($db_img_trangphuc, $image_trangphuc[$i]);
- }
- $image_trangphuc = json_encode($db_img_trangphuc);
- }
- else
- {
- $image_trangphuc = $db_img[0]['image_trangphuc'];
- }
- if($image_ngoc != NULL){
- for($i=0;$i<count($image_ngoc);$i++){
- array_push($db_img_ngoc, $image_ngoc[$i]);
- }
- $image_ngoc = json_encode($db_img_ngoc);
- }
- else
- {
- $image_ngoc = $db_img[0]['image_ngochotro'];
- }
- if($image_anhchung != NULL){
- for($i=0;$i<count($image_anhchung);$i++){
- array_push($db_img_anhchung, $image_anhchung[$i]);
- }
- $image_anhchung = json_encode($db_img_anhchung);
- }
- else
- {
- $image_anhchung = $db_img[0]['image_chung'];
- }
- $cost_acc = $this->input->post('cost_acc');
- $status = $this->input->post('status');
- if($game_type != NULL && $user_acc != NULL && $id_acc != NULL && $pass_acc != NULL && $info_acc != NULL && $cost_acc != NULL){
- $this->Admin_Model->shop_detail_process($id_acc,$game_type,$user_acc,$pass_acc,$more_info_acc,$info_acc,$image_tuong,$image_trangphuc,$image_ngoc,$image_anhchung,$cost_acc,$status);
- $_SESSION["sua_thanh_cong_vao_shop"] = 1;
- header("Location:".base_url()."admin/shop_detail/".$id_acc);
- }
- else
- echo "Chua nhap du thong tin";
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function shop_delete(){
- if(is_logged_in() && is_admin()){
- $id_acc = $_POST['id_acc'];
- if($id_acc != NULL){
- $dat = $this->Admin_Model->get_image_to_delete($id_acc);
- $image_tuong = json_decode($dat[0]['image_tuong'],true);
- $image_trangphuc = json_decode($dat[0]['image_trangphuc'],true);
- $image_ngochotro = json_decode($dat[0]['image_ngochotro'],true);
- $image_chung = json_decode($dat[0]['image_chung'],true);
- print_r($image_tuong);
- if($image_tuong != NULL){
- for($i=0;$i<count($image_tuong);$i++){
- unlink("/var/www/html/uploads/".$image_tuong[$i]);
- }
- }
- if($image_trangphuc != NULL){
- for($i=0;$i<count($image_trangphuc);$i++){
- unlink("/var/www/html/uploads/".$image_trangphuc[$i]);
- }
- }
- if($image_ngochotro != NULL){
- for($i=0;$i<count($image_ngochotro);$i++){
- unlink("/var/www/html/uploads/".$image_ngochotro[$i]);
- }
- }
- if($image_chung != NULL){
- for($i=0;$i<count($image_chung);$i++){
- unlink("/var/www/html/uploads/".$image_chung[$i]);
- }
- }
- $this->Admin_Model->delete_shop($id_acc);
- }
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function game($game)
- {
- if(is_logged_in() && is_admin()){
- $this->load->view('admin/shop/game/'.$game);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- ///////////Danh sach the nap///////////
- public function card_list()
- {
- if(is_logged_in() && is_admin()){
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = $this->Admin_Model->card_list();
- $data = array(
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- "data"=>$data,
- "csrf"=>$csrf,
- );
- $this->load->view('admin/mobilecard/index', $data, FALSE);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function card_list_process_confirm()
- {
- $username = $_POST['username'];
- $nhamang = $_POST['nhamang'];
- $masothe = $_POST['mathe'];
- $soserial = $_POST['serial'];
- $menhgia = $_POST['menhgia'];
- $trangthai = array();
- if(is_logged_in() && is_admin()){
- for($i=0;$i<count($username);$i++){
- array_push($trangthai,$this->Admin_Model->card_list_status($username[$i],$masothe[$i],$soserial[$i],$menhgia[$i]));
- }
- for($i=0;$i<count($username);$i++){
- if($trangthai[$i][0]['trangthai'] == 0){
- if($username[$i] != NULL && $masothe[$i] != NULL && $soserial[$i] != NULL && $menhgia[$i] != NULL){
- $this->Admin_Model->card_list_process($username[$i],$masothe[$i],$soserial[$i],$menhgia[$i]);
- $_SESSION["xacnhanthanhcong"] = true;
- }
- }
- else if($trangthai[$i][0]['trangthai'] == 1){
- $_SESSION["loixacnhanlai"] = true;
- }
- }
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function card_list_process_cancel_confirm()
- {
- $username = $_POST['username'];
- $nhamang = $_POST['nhamang'];
- $masothe = $_POST['mathe'];
- $soserial = $_POST['serial'];
- $menhgia = $_POST['menhgia'];
- $trangthai = array();
- if(is_logged_in() && is_admin()){
- for($i=0;$i<count($username);$i++){
- array_push($trangthai,$this->Admin_Model->card_list_status($username[$i],$masothe[$i],$soserial[$i],$menhgia[$i]));
- }
- for($i=0;$i<count($username);$i++){
- if($trangthai[$i][0]['trangthai'] == 1){
- if($username[$i] != NULL && $masothe[$i] != NULL && $soserial[$i] != NULL && $menhgia[$i] != NULL){
- $this->Admin_Model->card_list_process_detroy($username[$i],$masothe[$i],$soserial[$i],$menhgia[$i]);
- $_SESSION["huyxacnhanthanhcong"] = true;
- }
- }
- else if($trangthai[$i][0]['trangthai'] == 0){
- $_SESSION["loihuyxacnhanlai"] = true;
- }
- }
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- ///////////Danh sach the nap///////////
- // public function card_list_process()
- // {
- // $login = $this->Admin_Model->login();
- // $username = $this->input->post('username');
- // $masothe = $this->input->post('masothe');
- // $soserial = $this->input->post('soserial');
- // $menhgia = $this->input->post('menhgia');
- // $trangthai = $this->Admin_Model->card_list_status($username,$masothe,$soserial,$menhgia);
- // if(is_logged_in() && is_admin() == $login[0]['usrname']){
- // $xacnhan = $this->input->post('xacnhan');
- // $huyxacnhan = $this->input->post('huyxacnhan');
- // if(isset($xacnhan) && $xacnhan == "Xác nhận" && $trangthai[0]['trangthai'] == 0){
- // if($username != NULL && $masothe != NULL && $soserial != NULL && $menhgia != NULL){
- // $this->Admin_Model->card_list_process($username,$masothe,$soserial,$menhgia);
- // $_SESSION["xacnhanthanhcong"] = true;
- // header("Location:".base_url()."admin/card_list");
- // }
- // }
- // else if(isset($huyxacnhan) && $huyxacnhan == "Hủy" && $trangthai[0]['trangthai'] == 1){
- // if($username != NULL && $masothe != NULL && $soserial != NULL && $menhgia != NULL){
- // $this->Admin_Model->card_list_process_detroy($username,$masothe,$soserial,$menhgia);
- // $_SESSION["huyxacnhanthanhcong"] = true;
- // header("Location:".base_url()."admin/card_list");
- // }
- // }
- // else if(isset($xacnhan) && $xacnhan == "Xác nhận" && $trangthai[0]['trangthai'] == 1){
- // $_SESSION["loixacnhanlai"] = true;
- // header("Location:".base_url()."admin/card_list");
- // }
- // else if(isset($huyxacnhan) && $huyxacnhan == "Hủy" && $trangthai[0]['trangthai'] == 0){
- // $_SESSION["loihuyxacnhanlai"] = true;
- // header("Location:".base_url()."admin/card_list");
- // }
- // }
- // else
- // {
- // header("Location:".base_url()."admin/login");
- // }
- // }
- ///////////Danh Sach Mua Hang//////////////
- public function deal_history()
- {
- if(is_logged_in() && is_admin()){
- $csrf = array(
- 'name' => $this->security->get_csrf_token_name(),
- 'hash' => $this->security->get_csrf_hash()
- );
- $data = $this->Admin_Model->deal_history();
- $data = array(
- "acc_nav"=>$this->account_nav($_SESSION["admin_login"]),
- "data"=>$data,
- "csrf"=>$csrf,
- );
- $this->load->view('admin/deal/index', $data, FALSE);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- ///////////Danh Sach Mua Hang//////////////
- public function settings()
- {
- if(is_logged_in() && is_admin()){
- $info = $this->Admin_Model->account($_SESSION['admin_login']);
- $csrf = array(
- 'name'=>$this->security->get_csrf_token_name(),
- 'hash'=>$this->security->get_csrf_hash()
- );
- $data = array(
- 'csrf'=>$csrf,
- 'info'=>$info,
- );
- $this->load->view('admin/settings', $data, FALSE);
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- public function settings_process()
- {
- if(is_logged_in() && is_admin()){
- $info = $this->Admin_Model->account($_SESSION['admin_login']);
- $username = $this->input->post('username');
- $email = $this->input->post('email');
- if($this->input->post('password') != ""){
- $password = md5($this->input->post('password'));
- }
- else
- {
- $password = $info[0]['passwd'];
- }
- $this->Admin_Model->settings_change($username,$email,$password);
- redirect('/admin/settings');
- }
- else
- {
- header("Location:".base_url()."admin/login");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement