hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
namespace Note;
 
//д¼Ç¼
function WriteNote($data)
{
    unset($data['sign']);
    $dir = dirname(__FILE__)."\\note\\";
    $filename= $dir.date("Y-m-d",time()).".txt";
    $nowTime = date("Y-m-d H:i:s",time());
    
    //´´½¨Ä¿Â¼
    if (!is_dir($dir))
    {
        mkdir($dir);
    }
    
    $wstring = $nowTime."=>[";
    
    foreach ($data as $key => $value)
    {
        $wstring.= $key.":".$value.",";
    }
    
    $wstring .= "]\n";
    
    $f_open = fopen($filename, "a+") or die("file is not exist");
    fwrite($f_open, $wstring);
    fclose($f_open);
}
 
 
//¶Á¼Ç¼
function ReadNote($date1, $date2, $time1, $time2)
{
    $dir = dirname(__FILE__)."\\note\\";
    
    //´«½øµÄʱ¼ä
    $starTime = $date1." ".$time1;
    $endTime = $date2." ".$time2;
    
    
    if (!is_dir($dir))
    {
        return "can find nothing";
    }
    
    $showInfo = "";
    
    $curDate = strtotime($date1);
    
    while ($curDate <= strtotime($date2))
    {
        //Òª²éÕÒµÄÎļþÃû
        $filename= $dir.date("Y-m-d", $curDate).".txt";
        
        //²»´æÔÚ¸Äʱ¼äµÄÎļþ
        if (!file_exists($filename))
        {
            $curDate = strtotime('+1 day', $curDate);
            continue;
            #return date("Y-m-d", $curDate).":can find nothing";
        }
        
        //´ò¿ªÎļþ
        $fopen = fopen($filename, "rb") or die("file is not exist");
        
        while(!feof($fopen))
        {
            $lineInfo = fgets($fopen);
            $timeList = explode('=>[', $lineInfo);
            $noteTime = $timeList[0];
        
            if (strtotime($noteTime) >= strtotime($starTime) && strtotime($noteTime) <= strtotime($endTime))
            {
                $showInfo .= $lineInfo."<br/><hr><br/>";
            }
        }
        
        //¹Ø±ÕÎļþ
        fclose($fopen);
        
        //ʱ¼ä+1Ìì
        $curDate = strtotime('+1 day', $curDate);
    }
    
    if ($showInfo == "")
    {
        return "can find nothing";
    }
    
    return $showInfo;
    
}
 
//½âÎö×Ö·û´®×ª»»Êý×é
function parse($strinfo)
{
    //echo $strinfo;
    //½âÎö×Ö·û´®
    $POSTDATA = str_replace("=>","=",$strinfo);
    $POSTDATA = str_replace("\"","","$POSTDATA");
    $POSTDATA = str_replace("'","","$POSTDATA");
    $POSTDATA = str_replace("\n","","$POSTDATA");
    $POSTDATA = str_replace("\t","","$POSTDATA");
    $POSTDATA = str_replace("\r","","$POSTDATA");
    $POSTDATA = str_replace(",","&","$POSTDATA");
 
    //½«½âÎöºóµÄÄÚÈÝת»»³ÉÊý×é
    parse_str($POSTDATA,$arr);
 
    return $arr;
}
 
 
//¶ÁÊý×éÊý¾Ý
function ReadFile($File)
{
    //var_dump($File);
    //var_dump($ResultType);
 
    $dir = dirname(__FILE__)."\\cfg\\";
 
    if(!is_dir($dir))
    {
        echo $dir." can find nothing";
    }
    
    $showInfo = "";
 
    //Òª²éÕÒµÄÎļþÃû
    $filename= $dir.$File.".txt";
 
    //²»´æÔÚÎļþ
    if(!file_exists($filename))
    {
        echo filename.":can find nothing";
    }
    
    //´ò¿ªÎļþ
    $fopen = fopen($filename, "rb") or die("file is not exist");
 
    while(!feof($fopen))
    {
        $lineInfo = fgets($fopen);
        $showInfo .= $lineInfo;
        
    }
 
    //¹Ø±ÕÎļþ
    fclose($fopen);
    //$str = "array('key1'=>'value1','key2'=>'value2')";
    //echo iconv("GB2312","UTF-8",$showInfo);
    eval('$Resarr = ' .$showInfo .';' );
    //var_dump($Resarr);
    //echo "==========";
    //print_r($Resarr);
    //echo iconv("GB2312","UTF-8",$Resarr);
    //return;
    
    //$Resarr = parse($showInfo);
    //echo "===========================";
    //print_r($Resarr);
    //echo "===========================";
    //echo $Resarr["AccID"];
    
    //if(!array_key_exists($ResultType,$Resarr))
    //{
 
    //    echo 'ERROR : ['.$ResultType."] Key does not exists!";
    //    //echo iconv("GB2312","UTF-8","½á¹û£º".$ErrorType[(int)$arr['ErrorNo']]);
    //    echo "<br/><br/><br/>".$_POST['data'];
    //    return;
 
    //}
    
    
    //echo iconv("GB2312","UTF-8","Result£º".$Resarr[$ResultType]);
 
 
    if ($showInfo == "")
    {
        return "can find nothing";
    }
    
    return $Resarr;
    
}
 
 
?>