A.Adams A.Adams - 4 years ago 130
PHP Question

How to create a log out in my website?

So far, i can log in the website, but i don't really know if i am actually creating a session. I heard about PHP being the solution to my question, but i am not really familiar with PHP. So can someone show me how i can log in properly, displaying the username when on the website when logged in, to indicate that the user has actually logged in, and also, the log out link, so when clicked, the user logs out!

Answer Source

You have to first start the session

session_start();
$_SESSION['variable_name'] = $session_variable;

Now for Logout script use this

session_start();
session_unset();
session_destroy();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download