| Server IP : 162.214.74.102 / Your IP : 216.73.217.103 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/ |
Upload File : |
<?php
class Verifylogin_restadmin extends CI_controller{
function __construct()
{
parent::__construct();
$this->load->model('user','',TRUE);
$this->load->helper('form');
$this->load->helper('cookie');
$this->load->library('form_validation');
if($this->session->userdata('user_language'))
{
$language = $this->session->userdata('user_language');
}
else
{
$language = $this->config->item("language");
}
$data['user_language'] = $language;
$this->lang->load('restaurantAdmin', $language);
}
function index()
{
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";*/
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_check_password');
if($this->form_validation->run() == FALSE)
{
$data['username'] = '';
$data['password'] = '';
$data['ischecked'] = '';
$data['page'] = 'restaurantadmin_login';
$this->load->view('restaurantadmin/login',$data);
$this->load->view('frontend/footer');
//redirect('superadmin/', 'refresh');
}else
{
//Go to private area
if ($this->session->userdata('logged_in_restaurant')['is_restaurant'] == 0) {
redirect('restaurantadmin/dashboardrestaurant');
}
else {
redirect('restaurantadmin/updaterestaurant');
}
// $this->load->view('dashboard');
}
}
function check_password($password)
{
//Field validation succeeded. Validate against database
$username = $this->input->post('username');
//query the database
$result = $this->user->login_restaurant($username, md5($password));
if($result)
{
$sess_array = array();
foreach($result as $row)
{
$restaurant_id = $row->restaurant_id;
$sess_array = array(
'id' => $row->restaurant_id,
'is_admin' => 1,
'is_active' => $row->restaurant_status,
'is_restaurant' => $row->business_type,
'username' => $row->restaurant_name,
'restaurant_admin_image' => $row->admin_image
);
/// Remember Me
$rememberme = $this->input->post('rememberme');
if($rememberme)
{
//$this->input->set_cookie('cookiesample', '754767567', 3600);
///echo "string";
//exit();
$cookie = array(
'name' => 'remember_me_token_restaurant',
'value' => md5($restaurant_id),
'expire' => '36000' // Two weeks
);
$this->input->set_cookie($cookie);
$cookie2 = array(
'name' => 'remember_me_token_restaurant_pass',
'value' => $password,
'expire' => '36000' // Two weeks
);
$this->input->set_cookie($cookie2);
}else{
$this->input->set_cookie('remember_me_token_restaurant', '');
}
//--------------------
if($sess_array['is_active']==1)
{
$this->session->set_userdata('logged_in_restaurant', $sess_array);
if ($this->session->userdata('logged_in')) {
$this->session->unset_userdata('logged_in');
}
}else{
$this->form_validation->set_message('check_password', $this->lang->line('sorry_suspend'));
return false;
}
}
return TRUE;
}
else
{
$this->form_validation->set_message('check_password', $this->lang->line('Invalid_user_pass'));
return false;
}
}
}
?>