CodeIgniter Forums
function in a controller unusable - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: function in a controller unusable (/thread-45699.html)



function in a controller unusable - El Forum - 10-02-2011

[eluser]Unknown[/eluser]
Hello!

I am having this problem with CI:

I have a public function named `logout` in my controller named `user`.
this function *destroys* session.

now, {base_url}user/logout works fine *some times*. and some times, it doesn't.

rather, it just redirects to the previous page (page on which the link {base_url}user/logout was clicked).

when it is like this(redirecting back), the changes i make to the function aren't effecting the output!

i just removed the function and loaded {base_url}user/logout and it still worked! why? there was no function to respond.
I should get 404.
right?

it seems to me that somewhere CI is caching and there is some bug with cache (this is really wild guess)
OR
the session isn't being destroyed and since my session still exists, i am rightfully being redirected.
..
no but i was getting a page even when there wasn't a function! definitely bug!

please help me?

details you might need:
ubuntu 11.04, apache, php, mysql (all latest, updated).
codeigniter 2.0.3


EDIT:
killed the bug (in my code).
Was sending a permanently redirected header in my code. firefox seems to remember the links and their moved locations. so that was the bug. changed 3rd param of redirect to 307 from 301. solved!