| Server IP : 188.114.97.2 / Your IP : 104.23.197.230 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/nicolasj/www/sms.formationlangues.be/application/controllers/BO/ |
Upload File : |
<?php
/*********************
*********************
Template : "forms_student.php"
FrontEnd : "hello_student.php"
Controller : "Forms_student.php"
Creation 25/07/2019
Aernout Guillaume
https://codes.solutions
*********************
*********************/
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Customers extends NS_Controller
{
public function __construct()
{
parent::__construct(array('no_cache' => 1));
if ($this->session->userdata('admin_login') != 1) {
$this->error('restricted admin');
}
$this->load->helper('generator');
$this->load->model('customer_model');
$this->load->model('users_model');
$this->load->database();
}
public function index()
{
$this->load->view('backend/index', [
'page_name' => 'customers',
'sess' => $this->customer_model->get_sessions(3),
'page_title' => get_phrase('customers')
]);
}
public function refresh()
{
$lim = $this->input->post('lim'); // limite en mois
$data = $this->customer_model->get_customers($lim);
echo json_encode($data);
}
public function get_customer()
{
$id = $this->input->post('id');
$customer = $this->customer_model->get_customer($id);
$customer['connexe'] = $this->customer_model->get_customer_connexe($customer['IP']);
echo json_encode($customer);
}
public function manual_update()
{
$this->continueIfAllowed(array('allowed' => array('admin')));
$id = $this->input->post('sudentId');
$this->db->set('is_final', '1');
$this->db->where('user_id', $id);
$this->db->update('user');
echo "1";
}
public function reset_customers()
{
$this->continueIfAllowed(array('allowed' => array('admin')));
$this->db->set('Notified', '1');
$this->db->update('shop_transaction');
echo "1";
}
public function convert_invited()
{
$this->continueIfAllowed(array('allowed' => array('admin')));
$j = json_decode($this->input->post('json'), true);
$pass = $this->users_model->generate_pass(8);
var_dump($j);
if (!$this->users_model->email_exist($j['Mail'])) {
$id_address = $this->users_model->create_user_address($j['Add_Street'], '', 'Belgique', '', $j['Add_City'], $j['Add_Code']);
$id = '';
if ($id_address != '' && is_numeric($id_address)) {
$id = $this->users_model->create_user($j['Mail'], $pass, $j['Surname'], $j['Name'], $j['Phone'], '6', '1', '3', '1', '1');
echo $id;
}
} else {
echo "Email already Registred";
}
}
public function fullfilled_status()
{
$customer_id = $this->session->customer_id;
if (empty($customer_id)) {
echo json_encode(['fullfilled' => false]);
return;
}
$customer = $this->customer_model->get_customer((int) $customer_id);
if (empty($customer['Mail']) || !filter_var($customer['Mail'], FILTER_VALIDATE_EMAIL)) {
echo json_encode(['fullfilled' => false]);
return;
}
if (empty($customer['Name']) || empty($customer['Surname']) || empty($customer['Phone'])) {
echo json_encode(['fullfilled' => false]);
return;
}
if (empty($customer['Add_Street']) || empty($customer['Add_City']) || empty($customer['Add_Code'])) {
echo json_encode(['fullfilled' => false]);
return;
}
if (empty($customer['stripe_client_secret'])) {
echo json_encode(['fullfilled' => false]);
return;
}
echo json_encode(['fullfilled' => true]);
return;
}
public function validate_session()
{
$this->continueIfAllowed(array('allowed' => array('admin')));
$id = $this->input->post('id');
$user = $this->input->post('user');
$this->db->order_by('Linked_User', 'DESC');
$q = $this->db->get_where('shop_session', array('Linked_User' => $id))->result_array()[0];
$r = $this->customer_model->transaction_log('N/A', $user, '', $q, $q['Cart_Total'], "success", "manualy validated");
echo $r;
if (is_numeric($r)) {
var_dump($this->customer_model->update_session_manualy($id));
}
}
}