Sorted Sessions list

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
bakabaka
Posts: 15
Joined: Thu Mar 10, 2005 12:45 am
Location: USA
Contact:

Sorted Sessions list

Post by bakabaka »

One aspect of the PHPMyFAQ interface which has been a bit annoying for me has been the "Browse Sessions" admin interface. If I want to see the sessions for a different day, I have to browse through an unsorted list of days. After a bit of digging around I came up with the following.

In the file "admin/stat.main.php" from version 1.5.3, I replaced the following line ( line #88 ):

Code: Select all

        while ($dat = readdir($dir)) {
with the following code segment:

Code: Select all

$files = array();
        $dir = opendir(PMF_ROOT_DIR."/data");
        chdir(PMF_ROOT_DIR."/data");
        while (false !== ($file = @readdir($dir))) {
                if (substr($file,0,1)!=".")
                        array_push($files,$file);
                }
                closedir($dir);
                chdir("../");
                if ($files)
                        natcasesort($files);
                foreach ($files as $dat) {
It may not be perfect, and possibly not even necessary on other platforms. I'm running the server on Linux FWIW. I will say that it makes finding a given day much easier for me, even with the current sorting order. I'm not intimately familiar with PHP though, so I can't guarantee how well the code is written. Hope it helps someone!
jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

agreed ...

Post by jazcyk »

Thorsten and I have had a similar discussion.

They way sessions are stored (a text-file for each day) is not optimal for search. I would like to be able to sort with other criteria as well (ip, # of pages read etc ...)

I proposed that the seesion logs were converted from being text files to become database entries. Thorsten rejcted that, and he decides I guess ..

But he did promise me a facility to clear old session log with the admin panel of 1.6. In our case session logs more than a month old are not interesting. And it sums up to use quite a lot of diskspace over years!
Thorsten
Posts: 15562
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

the code looks good. I'll review it and patch it into the next version...

A deletion of old log files will be possible in 1.6.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply