Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 53
0 Users 6 Guests Online
Forum Index » PHP + MySQL » Killing the sessions?
Posted on Sunday 13th May 2007 at 02:04 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Hey, I made a ban script for my site. The only problem is that when they get forwarded back to the main login, I cannot kill the users sessions. I even tried forwarding them to the logout.php, but when they go there nothing shows up, and when they press login they are automatically back into the site. I was wondering how to completly kill the sessions. Here is my code if you need it:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
session_start
(0);
include(
'config.php');
$checkuser $logged['username']; // gets the username for the code below
$userb mysql_query("SELECT userlevel FROM members WHERE username = '$checkuser' ORDER BY id DESC LIMIT 1") or die (mysql_error());
$fetchbanned mysql_fetch_assoc($userb);
$banned $fetchbanned['userlevel'];

if(
$banned == 0) {
    echo 
"Sorry, you have been banned.
    <meta http-equiv='Refresh' content='3; URL=logout.php'/>"
;
} else {
    echo 
"Checking Login Status. . .
    <meta http-equiv='Refresh' content='2; URL=login.php'/>
    "
;
}
?>
<head><style>
body {
       color: black;
       font-size: 10px;
       font-family: verdana;
}</style></head>
<body></body>


Does anybody know how to fix this?

Thanks!
Posted on Sunday 13th May 2007 at 03:19 PM
ShadowMage
templates/default/images/noavatar.png's Avatar
Senior Member
Hey, if you wish to kill the session then use:

Code

session_destroy();
Posted on Sunday 13th May 2007 at 04:01 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Thank you, this worked perfectly.