Subversion-Projekte lars-tiefland.ci

Revision

Revision 2408 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
759 lars 1
<?php
2
 
3
/**
4
 *
5
 * @package WebanOS CI
6
 * @author Lars Tiefland <ltiefland@gmail.com>
7
 * @copyright 2016
8
 * @version $Rev: 2410 $
9
 */
10
 
11
class Login extends CI_Controller
12
{
2408 lars 13
	public function __construct()
14
	{
15
		parent::__construct();
16
		$this->load->model( 'Login_model', 'login' );
17
	}
18
	public function index()
19
	{
20
		$this->login_form();
21
	}
769 lars 22
 
2408 lars 23
	function execute()
24
	{
25
		if ( $this->form_validation->run() === false )
26
		{
27
			$this->login_form();
28
		} else
29
		{
30
			$res = $this->login->check_user();
2410 lars 31
			if ( !$this->session->user_data )
2408 lars 32
			{
33
				$this->login_form();
34
			} else
35
			{
36
				$this->session->username = $this->input->post( 'user' );
37
				$this->session->user_data = $res;
38
				header( "Location:/backend/" );
39
			}
40
		}
41
	}
789 lars 42
 
2408 lars 43
	private function login_form()
44
	{
45
		$data["errors"] = validation_errors();
46
		$data["title"] = "Anmeldung";
47
		$this->smarty->view( 'login.tpl', $data );
48
	}
801 lars 49
 
2408 lars 50
	public function logout()
51
	{
52
		$this->session->clicked = null;
53
		$this->session->clicked_tool = null;
54
		$this->session->filter = null;
55
		unset( $_SESSION["username"] );
56
		unset( $_SESSION["user_data"] );
57
		unset( $_SESSION["redirected"] );
58
		header( "Location:/backend/" );
59
	}
759 lars 60
}
61
 
1333 lars 62
?>