Welcome Guest, Not a member yet? Register   Sign In
after logging in back button can still be activated...
#4

[eluser]jeanel16[/eluser]
here ill explain,

i have a controller:

public function index() {
$this->load->library('form_validation');
$this->form_validation->set_rules('username1', 'Username', 'trim|required');
$this->form_validation->set_rules('password1', 'Password', 'trim|required');

if ($this->form_validation->run() == FALSE) {
//if there is a missing requirement

if($this->session->userdata('logged_in')) {
//it will test the session if it is set right?
//the user is logged in

$this->load->model('Loginmodel');
$data['data'] = $this->Loginmodel->post_data();
$this->load->view('contactview', $data);
}

else {

//the user is not logged in

$this->load->view('loginview');

}
else {
//if the user has inputted username and password
if($this->session->userdata('logged_in')) {
//it will again test if the session is set then the user is logged in already
it will redirect the user in the contactview.

$this->load->model('Loginmodel');
$data['data'] = $this->Loginmodel->post_data();
//inside the post_data() it will select all the data in the database table then
post it in the website. it is working i dont have problem with that
$this->load->view('contactview', $data);
}

else {
//if it is not yet logged in
$this->load->model('Loginmodel');
$this->Loginmodel->login();
if(!$this->Loginmodel->login()) {
//the loginmodel contains the admin database that it will compare
whether the inputed username and password is correct.
$this->load->view('loginview');
}
else {
$newdata = array(
'username' => 'heidi',
'email' => '[email protected]',
'logged_in' => TRUE
);
$user = $this->session->set_userdata($newdata);
$this->load->model('Loginmodel');
$data['data'] = $this->Loginmodel->post_data();
$this->load->view('contactview', $data);
}
}
}
}
}

i hope u understand my code Sad im hopeless


Messages In This Thread
after logging in back button can still be activated... - by El Forum - 05-21-2012, 06:27 PM
after logging in back button can still be activated... - by El Forum - 05-21-2012, 08:27 PM
after logging in back button can still be activated... - by El Forum - 05-21-2012, 10:55 PM
after logging in back button can still be activated... - by El Forum - 05-21-2012, 11:06 PM
after logging in back button can still be activated... - by El Forum - 05-21-2012, 11:42 PM
after logging in back button can still be activated... - by El Forum - 05-22-2012, 12:34 AM
after logging in back button can still be activated... - by El Forum - 05-22-2012, 12:34 AM
after logging in back button can still be activated... - by El Forum - 01-09-2014, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB