Файл: tyde/www/application/controllers/Main.php
Строк: 35
<?php
class Main extends CI_Controller
{
public function index ()
{
$this->load->view('header', ['title' => 'Главная страница']);
$this->load->view('main/index');
$this->load->view('footer');
}
public function user ($page = 1)
{
if (!$this->uauth->isAuth())
{
show_404();
}
$this->load->library('pagination');
$config['base_url'] = site_url('main/user');
$config['total_rows'] = $this->db->query('SELECT * FROM `codes` WHERE `user` = ?', [$this->uauth->get('id')])->num_rows();
$config['per_page'] = 20;
$config['full_tag_open'] = '<div class="def-pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$start = $page * $config['per_page'] - $config['per_page'];
$query = $this->db->query('SELECT * FROM `codes` WHERE `user` = ? LIMIT '.$start.', '.$config['per_page'], [$this->uauth->get('id')]);
$data = $query->result_array();
$this->load->view('header', ['title' => 'Кабинет']);
$this->load->view('main/user', ['codes' => $data]);
$this->load->view('footer');
}
public function signout ()
{
setcookie('user_id', '', -1, '/');
setcookie('sid', '', -1, '/');
header('location: /');
}
}