[eluser]praveenarya[/eluser]
sure here is my code
Code:
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->view('admin/welcome_message');
if($_SERVER['REQUEST_METHOD']=="POST")
{
$ssss="select * from ab_admin where ad_uname='".$_POST['log_id']."' and ad_pass='".$_POST['log_pswd']."' and ad_status=1";
$query=$this->db->query($ssss);
//$query = $this->db->query("select * from `ab_admin` where ad_uname='".$_POST['log_id']."' and ad_pass='".$_POST['log_pswd']."' and ad_status=1");
if ($query->num_rows() > 0)
{
foreach ($query->result_array() as $row)
{
session_unregister("ab_username");
session_unregister("ab_dispname");
session_unregister("ab_id");
session_unregister("ab_type");
//session_unregister("ab_email");
session_register("ab_username");
session_register("ab_dispname");
session_register("ab_id");
session_register("ab_type");
$_SESSION['ab_username']=$log_row['ad_uname'];
$_SESSION['ab_dispname']=$log_row['ad_dispname'];
$_SESSION['ab_id']=$log_row['ad_id'];
$_SESSION['ab_type']=$log_row['ad_admin_type'];
//$_SESSION['ab_email']=$log_row['ad_email'];
if($log_row['ad_master']=='1'){ session_unregister("ad_master"); session_register("ad_master"); $_SESSION['ad_master']='yes';}
if($log_row['ad_book']=='1'){ session_unregister("ad_book"); session_register("ad_book"); $_SESSION['ad_book']='yes';}
if($log_row['ad_travel']=='1'){ session_unregister("ad_travel"); session_register("ad_travel"); $_SESSION['ad_travel']='yes';}
if($log_row['ad_cms']=='1'){ session_unregister("ad_cms"); session_register("ad_cms"); $_SESSION['ad_cms']='yes';}
if($log_row['ad_user_manage']=='1'){ session_unregister("ad_user_manage"); session_register("ad_user_manage"); $_SESSION['ad_user_manage']='yes';}
if($log_row['ad_newsletter']=='1'){ session_unregister("ad_newsletter"); session_register("ad_newsletter"); $_SESSION['ad_newsletter']='yes';}
if($log_row['ad_ads']=='1'){ session_unregister("ad_ads"); session_register("ad_ads"); $_SESSION['ad_ads']='yes';}
$this->load->view('admin/welcome');
}
}else {
$data['errmsg']="Invalid Login Details";
$this->load->view('admin/welcome_message',$data);
}
}
}
}
and in view page i wrote
Code:
if(isset($errmsg)) { echo $errmsg;}