<?php
class login extends CI_controller
{
function __construct()
{
parent::__construct();
$this->load->model('dblogin');
}
function index()
{
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('password','Password','required');
$this->form_validation->set_error_delimiters("<div class ='error'>");
if($this->form_validation->run()==false)
{
$data['msg']='';
}
else
{
$result=$this->dblogin->chklogin($_POST['username'],$_POST['password']);
if($result)
{
$this->session->set_userdata('username',$_POST['username']);
$data['msg']='Login Sucess';
$this->session->set_flashdata(array('msg'=>'sucess','type'=>'Login Is Sucess'));
redirect('abc');
}
else
{
$data['msg']='Login Invalid';
}
}
$this->load->view('login_form',$data);
}
function forget()
{
$this->form_validation->set_rules('username','username','required');
if($this->form_validation->run()==false)
{
$data['msg']='';
}
else
{
$re=$this->dblogin->chkuser($_POST['username']);
if($re)
{
$pass=$this->dblogin->chkpass($_POST['username']);
$getpass=$pass->password;
$data['msg']=("<script language='javascript'>alert('Your Password Is....$getpass')</script>");
}
else
{
$data['msg']='User Wrong';
}
}
$this->load->view('forget',$data);
}
}
?>
class login extends CI_controller
{
function __construct()
{
parent::__construct();
$this->load->model('dblogin');
}
function index()
{
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('password','Password','required');
$this->form_validation->set_error_delimiters("<div class ='error'>");
if($this->form_validation->run()==false)
{
$data['msg']='';
}
else
{
$result=$this->dblogin->chklogin($_POST['username'],$_POST['password']);
if($result)
{
$this->session->set_userdata('username',$_POST['username']);
$data['msg']='Login Sucess';
$this->session->set_flashdata(array('msg'=>'sucess','type'=>'Login Is Sucess'));
redirect('abc');
}
else
{
$data['msg']='Login Invalid';
}
}
$this->load->view('login_form',$data);
}
function forget()
{
$this->form_validation->set_rules('username','username','required');
if($this->form_validation->run()==false)
{
$data['msg']='';
}
else
{
$re=$this->dblogin->chkuser($_POST['username']);
if($re)
{
$pass=$this->dblogin->chkpass($_POST['username']);
$getpass=$pass->password;
$data['msg']=("<script language='javascript'>alert('Your Password Is....$getpass')</script>");
}
else
{
$data['msg']='User Wrong';
}
}
$this->load->view('forget',$data);
}
}
?>
No comments:
Post a Comment