Hi,

Is there any scripts that would logout a user if they were already logged in with that username and password?

many thanks

Recommended Answers

All 3 Replies

I guess it's staithforward ... Basically, there's a link and a GET variable

<a href="this.php?doLogout=true">Logout</a>
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['Username'] = NULL;
  $_SESSION['pwd'] = NULL;
  unset($_SESSION['Username']);
  unset($_SESSION['pwd']);

    header("Location: index.php");
    exit;
  }

thanks i will give this a go.

what about destroy the active session?
To log user out will depend on login mechanism

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.