Alternative to PHP deprecated function session_is_registered() for logout.php file
<p>I'm trying to create a simple member login site, and I was following along with a tutorial online. However, a deprecated function is used. Here is the code.</p>

<pre><code>&lt;?php
session_start();

session_destroy();

if(isset($_COOKIE['id']))
{
    //remove cookie
    setcookie("$id_cookie", '', time() - 50000);
    setcookie("$pass_cookie", '', time() - 50000);
}

if(!session_is_registered('username'))
{
    header("Location: index.php");
}
else
{
    exit('Sorry we could not log you out');
}

?&gt;
</code></pre>

<p>I also tried <code>!isset($_SESSION['username'])</code>, but every time I try to log out, I just receive the 'Sorry we could not log you out' text.</p>

<p>Here is the part of my login.php file code where I set the sessions:</p>

<pre><code>//member does exist, start sessions
$_SESSION['password'] = $password;

while($row = mysql_fetch_array($query))
{
    $username = $row['username'];
    $id = $row['id'];
}

$_SESSION['username'] = $username;
$_SESSION['id'] = $id;
</code></pre>

<p>Any help would be great! </p>
