In view i have two folders pages, templates. Inside pages i have two folders nonmember and member. Inside templates i have header.php and footer.php. In nonmember folder i have a notification file, email_notification.php, along with other files like home.php, about.php etc.
pages are being generated dynamically using the following function
public function index(){
$this->nonmember();
}
public function nonmember($page = 'home'){
if (! file_exists(APPPATH.'views/pages/nonmember/'.$page.'.php')) {
show_404();
}
$data['title'] = ucfirst($page);
$this->load->view('templates/header', $data);
$this->load->view('pages/nonmember/'.$page, $data);
$this->load->view('templates/footer', $data);
}
And calling it in for showing login page or registration page
public function registration(){
//validation rules
if($this->form_validation->run()){
//add user to a temporary table
//send an email with an activation code
$this->nonmember('email_notification');
//that view says click the link in email for activating account
}else{
$this->nonmember('registration');
}
}
Problem is that email_notification view can also be accessed via url, which is not desirable. How do i prevent email_notification from direct access? like if user try to access it using url i want to redirect them back to home page, or show_error() ?