<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Bryan

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      37 Posts :: 3 Stories :: 24 Comments :: 0 Trackbacks
    There is one perl cgi system which runs on apache server,It's open to everyone and no users stored in file systems or Databases, client wants to know how many users are using this system. How?

    The only way I know is to use CGI::Session and cookie. each time,one client uses the system, we are using the CGI::Session to create one session , and this session should not duplicate for one user who are using the same browser(IE eg), and of course may differ for different browsers. The session will create session files in specified temp folder. each new session ,one session file. Then we can use one pl script to list active users ,actually ,that should be the number of session files in the session directory. And one thing we need to do is that we need to delete the expired session files before we want to compute the number of active users. we can use the module CGI::Session::ExpireSessions and delete the session files according to the session time-out age.

    $D = {'_SESSION_ID' => '772278a8aa05506449b4e72582d09f95','_SESSION_ATIME' => 1366012456,'_SESSION_REMOTE_ADDR' => '135.251.33.31','_SESSION_CTIME' => 1366012456};;$D

    session.pl
    #!C:/Perl/bin/perl

    use strict;
    use CGI;
    use warnings;
    use CGI::Session;

    #create session,if exists,use that one
    my $cgi = CGI->new;
    my $session = CGI::Session->new( undef, $cgi, {Directory=>'c:/tmp'} );

    my $cookie = $cgi->cookie(CGISESSID => $session->id );
    print $cgi->header(-cookie=>$cookie);
    my $sid = $session->id();
    #print $sid;
    #set session expired date
    #$session->expire(30);     
    print "  <a href=\"count.pl?sid=$sid\">list active users</a>";

    count.pl
    #!C:/Perl/bin/perl

    use strict;
    use CGI;
    use warnings;
    use File::Find::Rule;
    use CGI::Session;
    use CGI::Session::ExpireSessions;

    print "Content-type: text/html\n\n";

    #clear expired session
    CGI::Session::ExpireSessions -> new(delta => 30, temp_dir => 'c:\tmp', verbose => 0-> expire_file_sessions();

    my @files = File::Find::Rule->file()->in('c:\tmp');
    print "The number of active users is : ";
    print scalar @files, $/;

    I suppose the count.pl are always using the same session with the session.pl.And we need to also install the module File::Find::Rule.

    Apache HTTP Server Version 2.0 
    ActivePerl 5.16.3 Build 1603
    ActiveState Komodo Edit 7


    posted on 2013-04-15 15:58 Life is no respector of any genius. 閱讀(292) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: 亚洲性线免费观看视频成熟| 国产a级特黄的片子视频免费| 在线亚洲午夜片AV大片| 好爽又高潮了毛片免费下载 | 色哟哟国产精品免费观看| 中文字幕不卡亚洲 | 亚洲色欲色欲综合网站| 欧洲精品成人免费视频在线观看 | 一本久久a久久精品亚洲| 最近中文字幕2019高清免费| 亚洲一区二区观看播放| 国产精品亚洲产品一区二区三区| 100部毛片免费全部播放完整| 在线观看亚洲网站| 久久亚洲AV无码精品色午夜| 免费午夜爽爽爽WWW视频十八禁| 无码人妻精品中文字幕免费| 亚洲另类无码专区首页| 亚洲毛片αv无线播放一区| 青青青亚洲精品国产| 国产亚洲人成无码网在线观看| 国产免费一区二区视频| 亚洲成人动漫在线观看| 国产成人免费高清激情视频| 美女视频黄a视频全免费网站一区 美女视频黄a视频全免费网站色 | 国产美女在线精品免费观看| 黄色一级毛片免费| 国产亚洲人成A在线V网站 | 国产精品亚洲专一区二区三区| 亚洲中文字幕视频国产| 18级成人毛片免费观看| 国产亚洲高清在线精品不卡| 久久精品国产亚洲AV麻豆不卡| 国产精品免费高清在线观看| 伊人久久亚洲综合影院首页| 国产亚洲一区二区三区在线不卡| 国产成人精品免费视频大| 一级毛片不卡免费看老司机| 亚洲午夜在线一区| 亚洲精品国产精品乱码视色 | 国产免费爽爽视频免费可以看|