Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 226
Line 1... Line 1...
1
#!/usr/bin/php
1
#!/usr/bin/php
2
<?php
2
<?php
3
 
3
 
4
/*
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 17... Line 17...
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
18
    GNU General Public License for more details.
19
 
19
 
20
    You should have received a copy of the GNU General Public License
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
    
22
 
23
*/
23
*/
24
 
24
 
25
/*
25
/*
26
逐一bytes比對兩個檔案有哪些bytes不同
26
逐一bytes比對兩個檔案有哪些bytes不同
27
*/
27
*/
Line 59... Line 59...
59
	#結束執行,回傳shell 1.
59
	#結束執行,回傳shell 1.
60
	exit(1);
60
	exit(1);
61
 
61
 
62
	}#if end
62
	}#if end
63
 
63
 
64
#設置 include path 
64
#設置 include path
65
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
65
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
66
 
66
 
67
#匯入外部套件
67
#匯入外部套件
68
include("allInOne.php");
68
include("allInOne.php");
69
 
69
 
Line 87... Line 87...
87
#如果抓參數出錯
87
#如果抓參數出錯
88
if($getArgu["status"]==="false")
88
if($getArgu["status"]==="false")
89
{
89
{
90
	#印出內容
90
	#印出內容
91
	var_dump($getArgu);
91
	var_dump($getArgu);
92
	
92
 
93
	#結束執行
93
	#結束執行
94
	exit;
94
	exit;
95
}
95
}
96
 
96
 
97
#如果參數數量不等於3
97
#如果參數數量不等於3
98
if($getArgu["count"]!==3)
98
if($getArgu["count"]!==3)
99
{
99
{
100
	#印出內容
100
	#印出內容
101
	var_dump($getArgu);
101
	var_dump($getArgu);
102
	
102
 
103
	#結束執行
103
	#結束執行
104
	exit;
104
	exit;
105
}
105
}
106
 
106
 
107
#取得檔案A名稱
107
#取得檔案A名稱
Line 129... Line 129...
129
	if(!feof($fhA))
129
	if(!feof($fhA))
130
	{
130
	{
131
		#取得 1 bytes
131
		#取得 1 bytes
132
		$bytesA=fread($fhA,1);
132
		$bytesA=fread($fhA,1);
133
	}
133
	}
134
	
134
 
135
	#若檔案B尚未結束
135
	#若檔案B尚未結束
136
	if(!feof($fhB))
136
	if(!feof($fhB))
137
	{
137
	{
138
		#取得 1 bytes
138
		#取得 1 bytes
139
		$bytesB=fread($fhB,1);
139
		$bytesB=fread($fhB,1);
Line 142... Line 142...
142
	#兩邊都有資料時
142
	#兩邊都有資料時
143
	if( isset($bytesA) && isset($bytesB) )
143
	if( isset($bytesA) && isset($bytesB) )
144
	{
144
	{
145
		#解析A成16進位大小文數字
145
		#解析A成16進位大小文數字
146
		$bytesA=strtoupper(sprintf("%02s",base_convert(ord($bytesA),10,16)));
146
		$bytesA=strtoupper(sprintf("%02s",base_convert(ord($bytesA),10,16)));
147
		
147
 
148
		#解析B成16進位大小文數字
148
		#解析B成16進位大小文數字
149
		$bytesB=strtoupper(sprintf("%02s",base_convert(ord($bytesB),10,16)));
149
		$bytesB=strtoupper(sprintf("%02s",base_convert(ord($bytesB),10,16)));
150
		
150
 
151
		#如果有差異
151
		#如果有差異
152
		if($bytesA!==$bytesB)
152
		if($bytesA!==$bytesB)
153
		{
153
		{
154
		
154
 
155
			echo "於第 ".$addr." 個bytes處相異,左方為:".$bytesA.";右方為:".$bytesB.PHP_EOL;
155
			echo "於第 ".$addr." 個bytes處相異,左方為:".$bytesA.";右方為:".$bytesB.PHP_EOL;
156
			unset($bytesA);
156
			unset($bytesA);
157
			unset($bytesB);
157
			unset($bytesB);
158
			continue;
158
			continue;
159
		}
159
		}
160
	}
160
	}
161
	
161
 
162
	#單邊有資料
162
	#單邊有資料
163
	else
163
	else
164
	{
164
	{
165
		if(isset($bytesA))
165
		if(isset($bytesA))
166
		{
166
		{
167
			#解析A成16進位大小文數字
167
			#解析A成16進位大小文數字
168
			$bytesA=strtoupper(sprintf("%02s",base_convert(ord($bytesA),10,16)));
168
			$bytesA=strtoupper(sprintf("%02s",base_convert(ord($bytesA),10,16)));
169
		
169
 
170
			echo "於第 ".$addr." 個bytes處相異,左方為:".$bytesA.";右方不存在".PHP_EOL;
170
			echo "於第 ".$addr." 個bytes處相異,左方為:".$bytesA.";右方不存在".PHP_EOL;
171
			unset($bytesA);
171
			unset($bytesA);
172
			continue;
172
			continue;
173
		}
173
		}
174
		
174
 
175
		else if(isset($bytesB))
175
		else if(isset($bytesB))
176
		{
176
		{
177
			#解析B成16進位大小文數字
177
			#解析B成16進位大小文數字
178
			$bytesB=strtoupper(sprintf("%02s",base_convert(ord($bytesB),10,16)));
178
			$bytesB=strtoupper(sprintf("%02s",base_convert(ord($bytesB),10,16)));
179
		
179
 
180
			echo "於第 ".$addr." 個bytes處相異,左方不存在;右方為:".$bytesB.PHP_EOL;
180
			echo "於第 ".$addr." 個bytes處相異,左方不存在;右方為:".$bytesB.PHP_EOL;
181
			unset($bytesB);
181
			unset($bytesB);
182
			continue;
182
			continue;
183
		}
183
		}
184
		
184
 
185
		else
185
		else
186
		{
186
		{
187
			break;
187
			break;
188
		}
188
		}
189
	}
189
	}