<?php

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

class Auth extends Start_Controller {

   
    public function index() {
		
		
		$data =  array();
		$username='';
		$password='';
		$error_message='';
		$valid_entry=false;
		$valid_login=false;
	    $this->testLoginInput($username, $password, $error_message, $valid_entry);
		
	  if ( true == $valid_entry )
		{
			if ($username!='' &&  $password !=''){

			$data["page_title"] = "";
			$data["username"] = $username;  //"auxsupport";
			$data["password"] = "may12002";
			$this->jubabox_webapi(USER_LOGIN, $data, $out);
			//print_r( $data );
			//print_r( $out );
				if ( count($out) > 0 && isset($out[0]) ){
				$this->getSessionData($out[0], $session_data); // just for testing 
					
				$this->buildUserSession(PHP_API_OK,$session_data);
				$valid_login =  true;
			}
			else
			{
				$error_message ="Invalid Username/Password";
			}

			}	
		}
		
		
		
        $this->load->view('home/view_login');
    }

    public function forgotpass() {
        $this->index();
    }

    public function register() {
        $this->index();
    }

    public function logout() {
        $this->index();
    }

    public function login() {
        $this->index();
    }

}
