having log out issues when i click the log out button it does not destroy session so when the log in page loads it still sees that theres a live session and picks up on that heres the log out code for the buttons what is the correct way to code it so it also destroys current session

// if you need the user's information, just put them into the $_SESSION variable and output them here
echo WORDING_YOU_ARE_LOGGED_IN_AS . $_SESSION['user_name'] . "<br />";
//echo WORDING_PROFILE_PICTURE . '<br/><img src="' . $login->user_gravatar_image_url . '" />;
echo WORDING_PROFILE_PICTURE . '<br/>' . $login->user_gravatar_image_tag;

<a href= session_destroy();><?php echo WORDING_LOGOUT; ?></a>
<a href="views/edit.php"><?php echo WORDING_EDIT_USER_DATA; ?></a>

<?php include('views/_footer.php'); ?>



hope this helps.

In your href tag, put another php page and in that php page, do a session destroy and you can redirect using header() once the session is destroyed.

<a href= "logout.php"><?php echo WORDING_LOGOUT; ?></a>

In your logout.php

    header("Location: index.php");

session_destroy(); is a PHP function. Completely different from HTML, My advice:

Then on logout.php:

 if (session_destroy()){
    // redirect if session is sucessfully destroyed: 
     header("Location: page.php/html");
    echo "problem Occurred. Please contact the site administrator";


Though, i'm confsued as to why you would have so many defined constants, when you could just simply echo a string.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top