MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/allyindian_com/sbltt/application/controllers/Login.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller 
{
	public function __construct()
	{
		parent::__construct();
		 $this->load->model('Signups');
		 $this->load->model('Forgetpwds');
	}
	
	public function index()
	{

		if($this->Employee->is_logged_in())
		{
			redirect('home');
		}
		else
		{
			$this->form_validation->set_rules('username', 'lang:login_undername', 'callback_login_check');
    	    $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
			
			if($this->form_validation->run() == FALSE)
			{
				$this->load->view('login');
			}
			else
			{
				redirect('home');
			}
		}
	}
	
	public function login_check($username)
	{
		$password = $this->input->post('password');	
		
		if(!$this->Employee->login($username, $password))
		{
			$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_username_and_password'));

			return FALSE;
		}

		return TRUE;		
	}
	
	public function signup()
	{
		$this->load->view('signup');
			
	}
	
	public function forgetpwd()
	{
		$this->load->view('forgetpwd');
			
	}
	
	// used to valid and check user exist
	public function signup_check(){
		$Status = $this->Signups->save_signup($this->input->post('eml'), $this->input->post('mob'));
		$msg = $Status['msg'];
		if($Status['sts'] === "2"){
			echo json_encode(array('sts' => "2", 'message' => "SHOWLOGIN"));
		}else{
			echo json_encode(array('sts' => "1", 'message' => "SHOWOTP"));
		}
	}

	//Validate otp
	public function verify_otp(){
		$verifySts = $this->Signups->save_customer($this->input->post('otp'), $this->input->post('pwd'));

		if($verifySts['sts'] === "0"){
			echo json_encode(array('sts' => "0", 'message' => "INV_OTP"));
		}else{
			echo json_encode(array('sts' => "1", 'message' => "Created account"));
		}
		//print_r($verifySts);
	}

	public function forgetpwd_check(){
		$Status = $this->Forgetpwds->isvalidMob($this->input->post('mob'));
		echo $Status;
	}
	public function forgetpwd_verify_otp(){
		$Status = $this->Forgetpwds->isvalidOTP($this->input->post('otp'),$this->input->post('pwd'));
		echo $Status;
	}
	
}
?>