Did you mean a new blank article is added?
Your logout script is okay. But you can add more, like:
Code:
$_SESSION = array();
if(isset($_COOKIE[session_name()]))
{
setcookie(session_name(), '', time()-86400, '/');
}
session_destroy();
Here are few more suggestions:
Right after you add something into the database, redirect it to the add-successful page.
Don't just show the add-successful message in the same page (which can be refreshed by the user to add a duplicate copy of the article).
Make sure that your script (index) adds articles only for successfully logged in users, and they have pressed the add button in the form.
Don't put the INSERT SQL in your page that is loaded frequently (index). And just after inserting some data, redirect to other page. Use die(header('Location: add-successful.php')); to prevent loading. Here, if the user loads the page, the add-successful page is loaded, which does not have any INSERT sqls within it.
Hope, this helps you conceptually.
Bookmarks