-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
68 lines (65 loc) · 1.54 KB
/
test.php
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
<?php
echo session_save_path();
echo 1;
/* require("stdR.php");
define("LIST_FILE_NOT_CREATED", 50);
define("LIST_FILE_OPEN_FAILED", 51);
define("LIST_NOT_FOUND", 52);
define("TYPE_SESSID", 0);
define("TYPE_FIVEID", 1);
echo "<pre>";
$type=TYPE_SESSID;
$v = htmlspecialchars($_GET['v']);
if (strlen($v) == 5) {
$type = TYPE_FIVEID; //FIVE_ID
}
$a="e:";
$a=e($v,$type);
echo convertSRtoString($a);
addBreak();
function e($value,$type){
if (!file_exists("id_list")) {
//文件未创建
return generateStandardResponse(0, LIST_FILE_NOT_CREATED);
} else {
$list = fopen("id_list", "r");
}
$key=$type;
if ($key==TYPE_SESSID) {
$ans=TYPE_FIVEID;
}else{
$ans=TYPE_SESSID;
}
if (!$list) {
return generateStandardResponse(0, LIST_FILE_OPEN_FAILED);
} //防止指针无效
while (!feof($list)) { //feof死循环可能性微存,可能需要写watchdog
$row = fgetcsv($list);
echo "row:";
print_r($row);
addBreak();
if ($value == $row[$key]) {
echo "ftell after finded:";
echo ftell($list);
addBreak();
//fseek($list,-1,SEEK_CUR);
do {
fseek($list,-2,SEEK_CUR);
echo ftell($list);
$c=fgetc($list);
echo " ";
echo ord($c);
echo " ";
echo $c;
addBreak();
}while ($c!=chr(10));
for ($i=0;$i<=8;$i++){
fwrite($list,chr(0));
}
fclose($list);
return generateStandardResponse(1, CONTENT_PLAIN, $row[$ans]);
}
}return generateStandardResponse(0, LIST_NOT_FOUND);
}
echo "</pre>"; */
?>