Forum Moderators: coopster
I've created a password protected area for my website and it sometimes works. Basically, if I open FTP and delete any/all php sessions in my sessions folder prior to loging into my site it works fine... lol. For some reason the old session file(s) cause any new logins not to work.
If nothing else, is there a way I could run a batch file to delete old session when people visit the login page?
Here are a few things I've tried, any suggestions will be greatly appreciated.
[bugs.php.net...]
Google groups [groups.google.com]
Thanks,
RedBaron
[edited by: jatar_k at 2:51 pm (utc) on May 10, 2006]
[edit reason] fixed sidescroll [/edit]
<?php
$path = "sessionfolder/";
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle)){
/* IGNORE '.' UP DIRECTORIES */
if ($file!="." && $file!=".."){
/* IF SESSION IS <= 29 BITES THEN IT CONTAINS NO DATA SO DELETE IT*/
if (filesize($path.$file) <= 29){
return unlink($path.$file);
}
}
}
closedir($dir_handle);
?>
I am so proud of myself for figuring this one out :) but if there is a better way please let me know.