mu0641 发表于 2006 年 11 月 17 日 10:09:50

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 编辑 ]

afterall 发表于 2006 年 11 月 17 日 10:11:15

简                                                                           .

疏林阁 发表于 2006 年 11 月 17 日 11:01:49

很简洁。。

不错。。

就系css最好重新写下。。

jeatey 发表于 2006 年 11 月 17 日 11:39:00

太简单了吧

chungwoo 发表于 2006 年 11 月 17 日 11:40:40

;P
精神上支持:lol

禄林网络 发表于 2006 年 11 月 17 日 11:42:56

什么东西?? 看不懂啊

随波逐流 发表于 2006 年 11 月 17 日 13:06:30

好象很有创意 支持下!

ljweb 发表于 2006 年 11 月 17 日 13:06:30

好像不错的样子哦。。支持下。

ls1986 发表于 2006 年 11 月 17 日 13:09:49

再美化一下可能会好点

青涩宝贝 发表于 2006 年 11 月 17 日 13:17:49

这个空间曾经是偶的,楼主的QQ是?
页: [1] 2
查看完整版本: PHP写的一个文件下载程序