登錄後,我有一個登錄頁面,我有兩個user_types..one是供應商,另一種是用戶..獲得用戶ID在URL中笨
So..what我想要做的是,每當用戶或供應商從login..they登錄都重定向到dashboard..in,我想在URL中的USER_ID ..
這裏是我的登錄控制器:
公共職能登入() {
$data['error'] ="Invalid Login";
if($this->input->post())
{
$user = $this->LoginModel->login($this->input->post());
if(count($user)>0)
{
$data = array(
'user_id' => $user['user_id'],
'first_name' => $user['first_name'],
'email' => $user['email'],
'password' => $user['password']
);
$this->session->set_userdata($data);
if($user['user_type_id'] == '1')
{
redirect(base_url('index.php/Login/vendor_dashboard'));
}
elseif($user['user_type_id'] == '2')
{
redirect(base_url('index.php/Login/user_dashboard'));
}
else
{
redirect(base_url('index.php/Login/dashboard'));
}
}
else
{
$data["error_message"]="Invalid User Name and Password combination";
}
}
$ this-> load-> view('Admin/login_view',$ data);
}
這是我的模型:
function login($post='')
{
$this->db->where(array('email' => $post['email'], 'password' => $post['password']));
$query = $this->db->get('users');
return $query->row_array();
}
請人幫助我..
如何做到這一點..提前
謝謝..
,那麼你可以用$這個 - 它訪問> URI->段(3);在你打電話的函數 –
它的工作..感謝你..感謝很多.. – M5533
請注意我所做的改變,我的意思是它沒有真正必要的,但我已經chaged連接,而不是從會話中獲取數據訪問陣列.......也請接受我的答案,如果它有幫助 –