Jump to content

[SOLVED] Logout Validation


KaFF

Recommended Posts

You could do javascript...

 

<script language="JavaScript">
function confirmLogout()
{
var agree=confirm("Are you sure you want to log out?");
if (agree)
return true ;
else
return false ;
}
</script>

 

then for a link

 

<a href="logout.php" onClick="return confirmLogout()">logout</a>

Link to comment
Share on other sites

I tried using the javascript code as i currently have a href logout link on my pages but when i used the code in my logout.php it returned a blank page and didnt give the option of saying are you sure you want to logout.

I am using session variables at the top of my pages and the logout page currently looks like this

 

<?php
session_start();
session_destroy();
header("location:login.php");
exit();
?>

 

If you could tell me where i am going wrong i would greatly appreciate it.

 

KaFF

Link to comment
Share on other sites

You could do javascript...

 

<script language="JavaScript">
function confirmLogout()
{
var agree=confirm("Are you sure you want to log out?");
if (agree)
return true ;
else
return false ;
}
</script>

 

then for a link

 

<a href="logout.php" onClick="return confirmLogout()">logout</a>

 

I just tried using this script on my site, exactly as it was written, and with both buttons "Cancel" and "Agree" I was still logged out...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.