说明:部分函数是外部的,本程序的FTP是基于ZF写的,没提供,
运行是load.php?P=show,任何直接访问都没用
发上来只是供大家参考.
原理:
sent边发文件边写文件(随机创建一个),完了后删除文件.
原本是用session的,结果老是不对头,就用的这种方式.有意的可下到自己电脑上去看看.
直接运行是运行不起的,因为差文件.不是我不提供文件,我发上来只是供大家参考.
show.php->修正了的 把下面的代码替换show.php 主要修改了JS,变的更简单了
1
<?php
2
session_start();
3
if(!defined('BASE_URL'))die('Hacking Attmpt!');
4
$writescriptfile = BASE_URL.'bizman'.'.html';
5
//@unlink($writescriptfile);
6
$fileall = 'http://192.168.1.7/bizman.php';
7
/**DELETE 要用*/
8
$_SESSION['args_delete'] = '1';
9
$width = 652;
10
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
11
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
12
header ("Pragma: no-cache");
13
header("Expires: 0");
14
?>
15
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
16
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
17
<html xmlns="http://www.w3.org/1999/xhtml">
18
<head>
19
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
20
<title>Sent file to server</title>
21
<script type="text/javascript" src="http://192.168.1.7/js/jquery.js"></script>
22
<script type="text/javascript">
23
$(document).ready(function(){
24
getpage();
25
doProgress();
26
//$("#show").load("http://192.168.1.7/bizman.php");
27
});
28
function getpage(){
29
$.get("http://192.168.1.7/load.php?p=sent");
30
}
31
32
var i = 0;
33
function doProgress() {
34
if (i > 10) {
35
alert("sent data is ok");
36
return;
37
}
38
if (i <= 10) {
39
stetimes = setTimeout("doProgress()", 300);
40
showinfo(i);
41
i++;
42
}
43
}
44
function showinfo(Progress){
45
if (Progress) {
46
var html = $.trim($.ajax({
47
url: "http://192.168.1.7/bizman.php",
48
cache:false,
49
async: false//防止出现完成该操作所需的数据还不可使用
50
}).responseText);
51
switch(html){
52
case "unlogin" :
53
clearTimeout(stetimes);
54
$("#show").html('<script language="JavaScript">updateProgress("Can Not Login in Ftp Server.Please Check pass or user", 10 );<\/script>');
55
$.get("/load.php?p=delete");
56
break;
57
case "error" :
58
clearTimeout(stetimes);
59
$("#show").html('<script language="JavaScript">updateProgress("Can Not Connet Ftp Server.", 10);<\/script>');
60
$.get("/load.php?p=delete");
61
break;
62
break;
63
case "sentok" :
64
clearTimeout(stetimes);
65
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
66
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
67
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
68
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
69
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
70
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
71
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
72
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
73
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
74
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
75
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');
76
showUrl()
77
$.get("/load.php?p=delete");
78
break;
79
default:
80
$("#show").html(html);
81
// 注意这一句,过去不是这样的,不信可以对比一下两个文件
82
//$("#show").load("http://192.168.1.7/bizman.php");
83
//alert('我靠你老篾青的');
84
}
85
}
86
}
87
function updateProgress(sMsg, iWidth)
88
{
89
document.getElementById("status").innerHTML = sMsg;
90
document.getElementById("progress").style.width = iWidth + "px";
91
document.getElementById("percent").innerHTML = parseInt(iWidth / <?php echo $width; ?> * 100) + "%";
92
}
93
function showUrl(){
94
$("#show").append('<div style="position:absolute; top:55px; left:250px; text-decoration:none;"><a href="<?php echo $url ?>" target="_blank"><span style="color:red;font-size:15px; font-weight:bold;">Please click here go to vist you website!</span></a></div>');
95
}
96
</script>
97
</head>
98
<body>
99
<div style="margin:4px 4px 0px 20px; padding: 8px; color:#FF0000; font-size:13px; font-weight:bold;border: 1px solid gray; margin-left:14px;background: #EAEAEA; width: <?php echo $width+8; ?>px">
100
<div style="text-align:center"><font color="#FF0000">发送文件中
</font></div>
101
<div style="padding: 0; background-color: white; border: 1px solid navy; width: <?php echo $width; ?>px">
102
<div id="progress" style="padding: 0; background-color: #FFCC66; border: 0; width: 0px; text-align: center; height: 16px"></div>
103
</div>
104
<div id="status"> </div>
105
<div id="percent" style="position: relative; top: -30px; text-align: center; font-weight: bold; font-size: 8pt">0%</div>
106
</div>
107
<div id ="show"></div>
108
</body>
109
</html>
110
111
<?php 2
session_start(); 3
if(!defined('BASE_URL'))die('Hacking Attmpt!'); 4
$writescriptfile = BASE_URL.'bizman'.'.html'; 5
//@unlink($writescriptfile); 6
$fileall = 'http://192.168.1.7/bizman.php'; 7
/**DELETE 要用*/ 8
$_SESSION['args_delete'] = '1'; 9
$width = 652; 10
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 11
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 12
header ("Pragma: no-cache"); 13
header("Expires: 0"); 14
?> 15
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 16
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 17
<html xmlns="http://www.w3.org/1999/xhtml"> 18
<head> 19
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 20
<title>Sent file to server</title> 21
<script type="text/javascript" src="http://192.168.1.7/js/jquery.js"></script> 22
<script type="text/javascript"> 23
$(document).ready(function(){ 24
getpage(); 25
doProgress(); 26
//$("#show").load("http://192.168.1.7/bizman.php"); 27
}); 28
function getpage(){ 29
$.get("http://192.168.1.7/load.php?p=sent"); 30
} 31
32
var i = 0; 33
function doProgress() { 34
if (i > 10) { 35
alert("sent data is ok"); 36
return; 37
} 38
if (i <= 10) { 39
stetimes = setTimeout("doProgress()", 300); 40
showinfo(i); 41
i++; 42
} 43
} 44
function showinfo(Progress){ 45
if (Progress) { 46
var html = $.trim($.ajax({ 47
url: "http://192.168.1.7/bizman.php", 48
cache:false, 49
async: false//防止出现完成该操作所需的数据还不可使用 50
}).responseText); 51
switch(html){ 52
case "unlogin" : 53
clearTimeout(stetimes); 54
$("#show").html('<script language="JavaScript">updateProgress("Can Not Login in Ftp Server.Please Check pass or user", 10 );<\/script>'); 55
$.get("/load.php?p=delete"); 56
break; 57
case "error" : 58
clearTimeout(stetimes); 59
$("#show").html('<script language="JavaScript">updateProgress("Can Not Connet Ftp Server.", 10);<\/script>'); 60
$.get("/load.php?p=delete"); 61
break; 62
break; 63
case "sentok" : 64
clearTimeout(stetimes); 65
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 66
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 67
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 68
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 69
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 70
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 71
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 72
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 73
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 74
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 75
$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>'); 76
showUrl() 77
$.get("/load.php?p=delete"); 78
break; 79
default: 80
$("#show").html(html); 81
// 注意这一句,过去不是这样的,不信可以对比一下两个文件 82
//$("#show").load("http://192.168.1.7/bizman.php"); 83
//alert('我靠你老篾青的'); 84
} 85
} 86
} 87
function updateProgress(sMsg, iWidth) 88
{ 89
document.getElementById("status").innerHTML = sMsg; 90
document.getElementById("progress").style.width = iWidth + "px"; 91
document.getElementById("percent").innerHTML = parseInt(iWidth / <?php echo $width; ?> * 100) + "%"; 92
} 93
function showUrl(){ 94
$("#show").append('<div style="position:absolute; top:55px; left:250px; text-decoration:none;"><a href="<?php echo $url ?>" target="_blank"><span style="color:red;font-size:15px; font-weight:bold;">Please click here go to vist you website!</span></a></div>'); 95
} 96
</script> 97
</head> 98
<body> 99
<div style="margin:4px 4px 0px 20px; padding: 8px; color:#FF0000; font-size:13px; font-weight:bold;border: 1px solid gray; margin-left:14px;background: #EAEAEA; width: <?php echo $width+8; ?>px"> 100
<div style="text-align:center"><font color="#FF0000">发送文件中
</font></div> 101
<div style="padding: 0; background-color: white; border: 1px solid navy; width: <?php echo $width; ?>px"> 102
<div id="progress" style="padding: 0; background-color: #FFCC66; border: 0; width: 0px; text-align: center; height: 16px"></div> 103
</div> 104
<div id="status"> </div> 105
<div id="percent" style="position: relative; top: -30px; text-align: center; font-weight: bold; font-size: 8pt">0%</div> 106
</div> 107
<div id ="show"></div> 108
</body> 109
</html> 110
111

附件: processbar.zip
浙公网安备 33010602011771号