check_time.pl

来自「这个社区是虚拟社区使用的程序」· PL 代码 · 共 43 行

PL
43
字号
################
sub check_time{

open(TIME,"<$homedir/check_time.txt")|| &error("无法打开文件check_time.txt");
@list=<TIME>;
close(TIME);
$current_time=$now_sec;
  foreach $line(@list){
 @check=split(/=/,$line);  
 $temp=$current_time-@check[1];
   if($temp>$days){
 unlink ("$homedir/temp/@check[0].txt");
  @list = grep{ !(/$line/i) } @list;
 }#如果超过时间,就删除时间纪录档
unless(-e "$homedir/temp/@check[0].txt"){
  @list = grep{ !(/$line/i) } @list;
 }#如果聊天者已离开,就删除时间纪录档
}
   open(TIME,">$homedir/check_time.txt")|| &error("无法打开文件check_time.txt");
   print TIME @list;
   close(TIME);


open(TIME,"<$homedir/createroom.txt")|| &error("无法打开文件createroom.txt");
@list=<TIME>;
close(TIME);
$current_time=$now_sec;
   foreach $line(@list){
 @check=split(/=/,$line);  
 $temp=$current_time-@check[2];
   if($temp>$days){
 unlink ("$homedir/temp/rooms/@check[0]");
  @list = grep{ !(/$line/i) } @list;
 }#如果超过时间,就删除时间纪录档
 unless (-e "$homedir/temp/rooms/@check[0]") {
@list = grep{ !(/$line/i) } @list;
 }
  }
   open(TIME,">$homedir/createroom.txt")|| &error("无法打开文件createroom.txt");
   print TIME @list;
   close(TIME);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?