| Server IP : 188.114.97.2 / Your IP : 104.23.197.231 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/git/sms.edl.codes.solutions/application/controllers/BO/ |
Upload File : |
<?php
/*********************
*********************
Profile Controller : "Profile.php"
Profile Template : "profile.php"
Aernout Guillaume
http://Codes.Solutions
*********************
*********************/
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Profile extends NS_Controller {
function __construct() {
parent::__construct(array('no_cache'=>1));
$this->load->helper('generator');
$this->load->model('users_model');
$this->load->model('wallet_model');
$this->load->model('address_model');
$this->load->model('profile_model');
$this->load->database();
}
////////////////////////
// Fonction controller
////////////////////////
function index($arg) {
$this->load->helper('url');
$param = $this->uri->segment(3);
$data['page_name'] = 'profile';
$data['page_title'] = get_phrase('Profile');
$data['fullName'] = $this->session->userdata('name');
$data['role'] = $this->session->userdata('login_type');
$data['language'] = $this->profile_model->language();
$data['profile'] = $this->profile_model->data_profile();
if(isset($param)){
$data['reset'] = "true";
}
$this->load->view('backend/index', $data);
}
function reset(){
$pass = $this->input->post("pass");
if($this->profile_model->password_reset($pass)){
echo "1";
}
else{
echo "reset failled";
}
return true;
}
function edit(){
$this->continueIfAllowed(array('allowed'=>array('admin')));
$data = $this->input->post(array('pic','phone','dob','line_1','line_2','country','state','location','postcode','lang'));
$error = array();
$userId = $this->session->userdata('userID');
$userEmail = $this->crud_model->get_user_email($userId);
$userAddressId = $this->users_model->get_profile_address();
//echo $userAddressId;
if($this->users_model->check_phone($data['phone']) != true || ($data['phone'] == null || $data['phone'] == "" )){ array_push($error,"Please enter a correct phone number");}
if($this->session->userdata('login_type') != admin){
//admin dont need those forms
if($this->users_model->check_address($data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['postcode']) != true){array_push($error,"Please enter a correct address");}
$dob = str_replace('/', '-', $data['dob']);
$dob = date('Y-m-d', strtotime($dob));
if($this->users_model->check_dob($dob) != true || ($data['dob'] == null || $data['dob'] == "" )){ array_push($error,"Please enter a correct date of birth");}
}
$error = array_filter($error);
if (empty($error)){
//update user + address
if(!$this->users_model->update_user($userId,$userEmail,'','','',$data['phone'],$data['lang'])){
echo "sql crash";
return false;
}
if($userAddressId != "0"){
$this->users_model->update_user_address($userAddressId,$data['line_1'],$data['line_2'],$data['country'],$data['state'],$data['location'],$data['postcode']);
}
$this->profile_model->set_session_lang(); // set language
echo "1";
}
else{
var_dump($error);
}
}
}