<?php

class Dashboard extends Controller {
  function Dashboard(){
    parent::Controller();
    session_start();
	if ($_SESSION['userid'] < 1){
    	redirect('login','refresh');
    }
  }
  
 
  function index(){	
	$data['liID']=$this->uri->segment(2);
	$data['title'] = "Ν/ΚΕΠΑ - Σελίδες Διαχείρησης Περιεχομένου";
	$data['hideColumn']="hideboth";
	$data['main'] = 'admin/home';
	$this->load->vars($data);
	$this->load->view('admin/dashboard_tpl');
  }

 
 function logout(){
	unset($_SESSION['userid']);
	$this->session->set_flashdata('error',"You've been logged out!");
	redirect('home','refresh'); 	
 }
  function verify(){
  	$this->load->library('encrypt');
	if ($this->input->post('username')){
		$u = $this->input->post('username');
		$pw = $this->input->post('password');
		$row = $this->MAdmins->verifyUser($u,$pw);
		if (count($row)){
			$_SESSION['userid'] = $row['id'];
			redirect('admin/dashboard','refresh');
		}else{
			redirect('admin','refresh');
		}
	}else{
		redirect('admin','refresh');
	}  
   
  }


}
?>