/[LeafOK_CVS]/pvpgn-1.7.4/utils/bin/char_cleanup.php
ViewVC logotype

Annotation of /pvpgn-1.7.4/utils/bin/char_cleanup.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Jul 12 10:01:45 2008 UTC (17 years, 8 months ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Update

1 sysadm 1.1 <?
2    
3     if (!isset($_SERVER["argc"]) || $_SERVER["argc"] != 3)
4     {
5     echo "Error usage\n";
6     exit(1);
7     }
8    
9     $file = $_SERVER["argv"][1];
10     $expire_tm = $_SERVER["argv"][2];
11    
12     $pos = strrpos($file, "/");
13     if ($pos === false)
14     {
15     $char = $file;
16     }
17     else
18     {
19     $char = substr($file, $pos + 1);
20     }
21    
22     $fp = fopen($file, "rb")
23     or die("Open input file failed");
24    
25     fseek($fp, 8, SEEK_SET);
26     $data = fread($fp, 4);
27    
28     fclose($fp);
29    
30     $tm = hexdec(sprintf("%02x%02x%02x%02x", ord($data[3]), ord($data[2]), ord($data[1]), ord($data[0])));
31    
32     if (strcmp(date("Ymd", $tm), $expire_tm) < 0)
33     {
34     echo date("Ymd", $tm)."\t".$char."\t";
35     if (rename("/usr/local/pvpgn/var/charsave/".$char, "/usr/local/pvpgn/var/charsave_old/".$char))
36     {
37     if (unlink($file))
38     {
39     echo "DONE\n";
40     }
41     else
42     {
43     echo "FAILED del\n";
44     }
45     }
46     else
47     {
48     echo "FAILED move\n";
49     }
50     }
51    
52     ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1