|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
接触MYSQL,开始设计数据库程序 联合js做的,详细的话响应要做修正,好比目次制
以下是法式代码<BR><script language="JavaScript"><BR>with (document) {<BR> write("<STYLE TYPE='text/CSS'>");<BR> write(".child ")<BR> write("</STYLE>");<BR> }<BR>function initIt(){<BR> divColl = document.all.tags("DIV");<BR> for (i=0; i<divColl.length; i++) {<BR> whichEl = divColl(i);<BR> if (whichEl.className == "child") whichEl.style.display = "none";<BR> } }<BR>function expandIt(el) { whichEl = eval(el + "Child");<BR> if (whichEl.style.display == "none") {<BR> whichEl.style.display = "block";<BR> }<BR> else {<BR> whichEl.style.display = "none";<BR> }<BR> }<BR>onload = initIt;<BR></script><BR><LINK href=../main.css rel=stylesheet type=text/css><BR><?<BR>function hsort($a)<BR> {<BR> $b='';<BR> $c='';<BR> for($i=0;$i<count($a);$i++)<BR> {<BR> $j=substr($a[$i],0,1);<BR> if($j=='d')<BR> if($i==0)<BR> $b=$a[$i];<BR> else<BR> $b.='&&%%'.$a[$i];<BR> else<BR> if($i==0)<BR> $c=$a[$i];<BR> else<BR> $c.='&&%%'.$a[$i];<BR> }<BR> if($b=='')<BR> {<BR> $ff=explode('&&%%',$c);<BR> return $ff;<BR> }<BR> else<BR> {<BR> if($c=='')<BR> {<BR> $ff=explode('&&%%',$b);<BR> return $ff;<BR> }<BR> else<BR> {<BR> $f1=$b.'&&%%'.$c;<BR> $ff=explode('&&%%',$f1);<BR> return $ff;<BR> }<BR> }<BR> }<BR>require("./class/ftp.php");<BR>$HOST='localhost';<BR>$USER='huyang';<BR>$PASS='huyang';<BR>function ftpurl($url,$konge,$in,$name)<BR> {<BR> if($konge>10)<BR> {}<BR> else<BR> {<BR> global $HOST,$USER,$PASS;<BR> $ftp=new ftp;<BR> $ftp->init($HOST,$USER,$PASS);<BR> $ftp->initpwd($url);<BR> $a=$ftp->mulu();<BR> $ftp->close();<BR> $a=hsort($a);<BR> if($in!=1)<BR> {<BR> $sss=$name.'Child';<BR> echo'<div id="'.$sss.'" class="child">';<BR> }<BR> $v=0;<BR> for($i=1;$i<count($a);$i++)<BR> {<BR> $aa=explode(' ',$a[$i]);<BR> $j=substr($aa[0],0,1);<BR> if($j=='t')<BR> {}<BR> elseif($j=='d')<BR> {<BR> $c=count($aa);<BR> $c-=1;<BR> if(($aa[$c]=='.')||($aa[$c]=='..'))<BR> {}<BR> else<BR> {<BR> $v++;<BR> if($in==1)<BR> {<BR> $name1='URL'.$v.'Parent';<BR> $names='URL'.$v;<BR> echo'<div id="'.$name1.'" class="parent">';<BR> echo'<a href="#" '".$names."'";<BR> echo'); return false" ><img src="http://www.163design.net/p/b/img/plus.gif" border=0>'.$aa[$c].'</a></div><BR> ';<BR> }<BR> else<BR> {<BR> $names=$name.'_'.$v;<BR> echo'<a href="#" '".$names."'";<BR> echo'); return false" >';<BR> for($hu=0;$hu<$konge;$hu++)<BR> echo'<img src="http://www.163design.net/p/b/img/spacer.gif" border=0 alt="">';<BR> echo'<img src="http://www.163design.net/p/b/img/plus.gif" border=0>'.$aa[$c].'</a><br><BR> ';<BR> }<BR> $url1=$url.'/'.$aa[$c];//may be need to change<BR> $konge1=$konge+1;<BR> ftpurl($url1,$konge1,0,$names);<BR> }<BR> }<BR> else<BR> {<BR> $c=count($aa);<BR> $c-=1;<BR> if($in==1)<BR> {<BR> $name='URL'.$i.'Parent';<BR> $name1='URL'.$i;<BR> echo'<div id="'.$name.'" class="parent">';<BR> echo'<a href="#"><img src="http://www.163design.net/p/b/img/open.gif" border=0>'.$aa[$c].'</a></div><BR> ';<BR> }<BR> else<BR> {<BR> echo'<a href="#">';<BR> for($hu=0;$hu<$konge;$hu++)<BR> echo'<img src="http://www.163design.net/p/b/img/spacer.gif" border=0 alt="">';<BR> echo'<img src="http://www.163design.net/p/b/img/open.gif" border=0>'.$aa[$c].'</a><br><BR> ';<BR> }<BR> }<BR> }<BR> if($in!=1)<BR> echo'</div>';<BR> }<BR> }<BR>$ftp=new ftp;<BR>$ftp->init($HOST,$USER,$PASS);<BR>$s=$ftp->pwd();<BR>$ftp->close();<BR>ftpurl($s,0,1,'URL1'); //$s may be need to change<BR>?><BR>
[Ctrl+A 全体选择 提醒:你可先修正局部代码,再按运转]
以下为类文件
以下是法式代码<BR><?<BR>class ftp<BR> {<BR> var $id,$tid,$HOST,$USER,$PASS,$pwd;<BR> var $china_mulu;<BR> function init($HOST,$USER,$PASS)<BR> {<BR> $this->HOST=$HOST;<BR> $this->USER=$USER;<BR> $this->PASS=$PASS;<BR> $this->setup();<BR> }<BR> function setup()<BR> {<BR> if($this->HOST=='')$this->HOST='localhost';<BR> if($this->USER=='')$this->USER='';<BR> if($this->PASS=='')$this->PASS='';<BR> $this->id=ftp_connect($this->HOST) or $this->ftp_msg("can not connect ftp");<BR> $this->tid=ftp_login($this->id,$this->USER,$this->PASS) or $this->ftp_msg("can not open it");<BR> }<BR> function pwd()//获得途径<BR> {<BR> $this->pwd=ftp_pwd($this->id);<BR> return $this->pwd;<BR> }<BR> function initpwd($pwd)<BR> {<BR> $this->pwd=$pwd;<BR> }<BR> function mulu()//获得目次<BR> {<BR> if(!$this->pwd)<BR> $this->pwd=ftp_pwd($this->id);<BR> $this->chinamulu=ftp_rawlist($this->id,$this->pwd);<BR> return $this->chinamulu;<BR> }<BR> function upmulu()//前往下级目次<BR> {<BR> $a=ftp_cdup($this->id) or $this->ftp_msg("already be the uppest!!");<BR> }<BR> function close()<BR> {<BR> ftp_quit($this->id);<BR> }<BR> function ftp_msg($err)<BR> {<BR> print"<font color=red><h1><center>$err</center></h1></font>";<BR> }<BR> }<BR>?><BR>
[Ctrl+A 全体选择 提醒:你可先修正局部代码,再按运转]
也得学会了PHP。然后再学,见异思迁是最不可取的,狗熊掰玉米就是这个道理,如果经常中途放弃,只能是一无所获,还浪费了N多的时间和经历,得不偿失,最重要的是,你会被别人瞧不起。 |
|