PHP写的一个文件下载程序
学习PHP断断续续也有二周了自己写了个下载程序
大家给看看
index.php
<html>
<head>
<link href="index.css" rel="stylesheet" type="text/css">
</head>
<body background="bg-1.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="300" height="32" border="1" align="center" cellpadding="0" cellspacing="0">
<?
$filename="link.txt";
$result=file($filename);
$count=count($result);
if($count<12){
$page=1;
}else{
$a=$count%12;
if($a==0){
$page=$count/12;
}else{
$page=floor($count/12)+1;
}
}
for($i=1;$i<=$page;$i++) {
echo "<a href=index.php?j=$i>$i</a>";
}
if(!isset($j)){
$j=1;
}
$ye=$count/12;
if($j>$ye){
$max=$count-($j-1)*12-1;
$min=0;
}else{
$max=$count-($j-1)*12-1;
$min=$count-$j*12;
}
for($max;$max>=$min;$max--){
$show=explode("|",$result[$max]);
print "<tr><td>$show</td><td><a href=$show>下载</a></td></tr>";
}
?>
</table>
</html>
input.html
<html>
<head>
</head>
<body>
<form action=input.php method=post>
文件介绍:<input type="text" name="name"><p>
文件地址:<input type="text" name="url"><p>
<input type="submit" value="发送"><input type="reset" value="重填">
</form>
</body>
</html>
input.php
<?
$input=$name."----上传时间".date('Y-m-d')."|".$url."\r\n";
if(isset($name)){
$fp=fopen("link.txt","a");
fputs($fp,$input);
fclose($fp);
echo "ok";
}
?>
还有一个link.txt
一个1.07M的文本数据生成了一千多页 那个速度真是快啊
演示:http://f58.aaa.livedoor.jp/~shayuhu/down/
[ 本帖最后由 mu0641 于 2006-11-17 12:09 编辑 ] 简 . 很简洁。。
不错。。
就系css最好重新写下。。 太简单了吧 ;P
精神上支持:lol 什么东西?? 看不懂啊 好象很有创意 支持下! 好像不错的样子哦。。支持下。 再美化一下可能会好点 这个空间曾经是偶的,楼主的QQ是?
页:
[1]
2