|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
学习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[0]</td><td><a href=$show[1]>下载</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 编辑 ] |
评分
-
查看全部评分
|