|
-
January 3rd, 2009, 12:35 PM
#5
Re: Delete data on browser close.
I am having the same problem. And until i read this thread, I hadn't put much thought into the fix for it. I have an idea, though, depending on how many people you have logged in it might slow the page down a bit.
This is just an idea, haven't really felt like put the code together.
Place a code, something like the below, in index.php, under session_start();
my index.php contains all files necessary
Code:
//pseudocode
mysql_connect
mysql_select_db "logged in users"
$ch = mysql_query("SELECT from "logged in users"
while($row = mysql_fetch_array($ch)){
if(!isset($_SESSION[$row['SessionId']]))
delete old-log-in info
}
Code:
//index.php
<?php
session_start();
//place above code idea here
echo "<head>
<link rel='stylesheet' href='css/index.css'>
</head>
<body>
<div class='Main'>";
include 'Data/login.php'; //header - top
include 'navigation1.php'; //navigation - underneath header
include 'switch1.php'; //switch statements - takes care of body
include 'usersOnline.php'; //footer - bottom
echo "</div>
</body>";
?>
So, the bad thing about it, for me:
1. if 1000 people were, at one time or another, logged in, it would have to check each and everyone
2. it would check each and everytime someone logged in or clicked on a link
Good thing, for me:
1. it would be road kill on deleting old log-in info
Last edited by zaryk; January 3rd, 2009 at 12:54 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|