<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Test extends CI_Controller {

  public function __construct(){
    parent::__construct();
  }

	public function get_ip(){
		$ip = $this->input->ip_address();
		if ($this->session->userdata('user_ip') == '') {
			$this->session->set_userdata('user_ip', $ip);
		}else{
			$this->session->unset_userdata('user_ip');
			$this->session->set_userdata('user_ip', $ip);
		}
		echo json_encode(array('st'=>1));
	}

	public function visitors(){
		$data = array();
    $data['visitor'] = $this->admin_m->select('unique_visitors');
    echo "<pre>";print_r($data['visitor']);exit();
    $data['main_content'] = $this->load->view('admin/test',$data,TRUE);
    $this->load->view('admin/index',$data);
  }

  public function set_setting($layout,$slug)
  {

   $u_info = get_user_info_by_slug($slug);
   $data = array(
    'layouts' => $layout,
  );
   $edit =  $this->admin_m->update($data,$u_info['id'],'users');
   redirect(base_url('profile/'.$slug));
 }
 public function set_color($color,$slug)
 {

   $u_info = get_user_info_by_slug($slug);
   $data = array(
    'colors' => $color,
  );
   $edit =  $this->admin_m->update($data,$u_info['id'],'users');
   redirect(base_url('profile/'.$slug));
 }

 public function set_themes($themes,$slug)
 {
   $u_info = get_user_info_by_slug($slug);
   $data = array(
    'themes' => $themes,
  );
   $edit =  $this->admin_m->update($data,$u_info['id'],'users');
   redirect(base_url('profile/'.$slug));
 }




}



