-
Notifications
You must be signed in to change notification settings - Fork 0
/
exec_data.php
76 lines (70 loc) · 2.81 KB
/
exec_data.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
69
70
71
72
73
74
75
76
<?php
/*******************************************
NOTICE OF COPYRIGHT //
// //
// MKhoster document plagirism
// http://mkhoster.com
//
// Copyright (C) 2008
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 1
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details:
//
// http://www.gnu.org/copyleft/gpl.html
//created by Mohamed Ali
//email [email protected]
//dtate 22-12-2008
*******************************************/
/*******************************************
*******************************************/
include_once("config.php");
include_once("msg.php");
//get file name to read it and set it's content to array
//also do pattern check nad remove new lines
$fileto_read = $files_upload_path.$_POST["file_name"]; //获得传输过来的数据
$dataarr = array();
$temp_data = "";
//特殊字符处理,将文本中的特殊字符处理完毕。
$old_val = array("\r\n", "\n", "\r" ,"*","'" , '"');
$replace = array("", "", "" ,"" , "\'" , '\"');
//主要获得处理后的数据,并且将数据存入$datarr中。
if (file_exists($fileto_read))
{
//open file for read
$handle = @fopen($fileto_read, "r");
if ($handle) {
while (!feof($handle)) {
$temp_data = trim( str_replace($old_val, $replace,fgets($handle, 128)));
$ffind = strpos($temp_data , " " );//第一个" "的位置
$lfind = strrpos($temp_data , " " ) - strpos($temp_data , " " );//最后一个位置
$temp_data = trim(substr($temp_data,$ffind , $lfind));//截取长串,并且获得最终处理的字串
//定义搜索文本为40字单位
//该点用于修补搜索少于40字的bug,by twins
if( $long_string_search && ( strlen($temp_data) < $long_string_search_value) ) {
$dataarr[] = $temp_data;
}
elseif($long_string_search && ( strlen($temp_data) >= $long_string_search_value) )
{
$dataarr[] = $temp_data;
}
else
{
continue;
}
}
fclose($handle);
}
}
//handel error message if there is a problem finding file
else
{
echo $err_file_not_found;
}
?>