When a user logs in, a session id is generated accordingly. There is a ‘logout’ link on the page. On clicking the link a jquery ajax method is called to execute a php file which just unsets the session id variable.
If any user uses Firebug or any such tool to see the called-in file address, then s/he can just put the file address in the address bar and the press the ‘Enter’ key to execute the php file which will consequently log the user out which I do not want to happen.
How to prevent the user from doing that? Http_referrer or any such thing?
Scripting language is php.
You could have the AJAX call POST a variable to the PHP page, which the PHP page checks bofore logging the user out.
If it is a matter of making sure they redirect to the home page after logging out, make the a link to the logout page, then use PHP to send
header("Location: home.php");. This has the added bonus of still working even if JavaScript is disabled.