[eluser]mattpointblank[/eluser]
Hi everyone.
I'm writing a function to allow user interaction with my site. The idea is that if someone tries to take an 'action' (eg post a comment, rate a photo, etc), if they're not logged in, I redirect them to a register/login page. Once they've logged in, I send them back to the page they were posting a comment on, with the comment they typed already in the textarea.
The comment form points to this function (in my 'article' controller)
Code:
function addComment()
{
$this->load->helper('url');
if(!$this->session->userdata('logged_in')) {
$newdata = array(
'comment' => $this->input->post('comment')
);
$this->session->set_userdata($newdata);
redirect('/user/authenticate');
} else {
// TODO: add their comment to database here
}
}
This then redirects them to the /user/authenticate function, which logs them in. The login function then sends them back to the original page. The comment, however, doesn't get stored. From what I can gather, CodeIgniter destroys the $_POST array after changing controllers? I set the global XSS filter to FALSE but still nothing. Can anyone help? When I tried replacing the $_POST value with a 'hello world' string, it worked fine.