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

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

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

    Bryan

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      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)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 国产伦精品一区二区三区免费下载| 在线看片韩国免费人成视频| 免费无遮挡无码永久在线观看视频| 亚洲精品不卡视频| 免费网站看av片| 国产亚洲无线码一区二区| 二级毛片免费观看全程| 亚洲国产专区一区| 一级做a爰片性色毛片免费网站| 国产成人青青热久免费精品| 亚洲AV无码国产剧情| 午夜dj免费在线观看| 337p日本欧洲亚洲大胆人人 | 四虎在线视频免费观看视频| 亚洲人成在线电影| 日韩在线不卡免费视频一区| 亚洲综合无码一区二区| 在线人成精品免费视频| 亚洲天堂一区二区三区| 天天看免费高清影视| 男女猛烈无遮掩视频免费软件| 亚洲中文字幕成人在线| 波霸在线精品视频免费观看| 亚洲av永久无码精品漫画 | 国产嫩草影院精品免费网址| 特级aaaaaaaaa毛片免费视频| 2048亚洲精品国产| 免费国产成人18在线观看| 亚洲小视频在线播放| 日日夜夜精品免费视频| jyzzjyzz国产免费观看| 亚洲AV日韩精品久久久久久久| 国产大片免费网站不卡美女| 亚洲Av无码国产一区二区| 一本久久a久久精品亚洲| 在线日本高清免费不卡| 国产亚洲视频在线观看| 亚洲国产成人高清在线观看| 野花高清在线电影观看免费视频 | 99亚洲乱人伦aⅴ精品| 亚洲乱码精品久久久久..|