473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to ignore/avoid empty folders in PHP ?

3
Hello,
Here is a simple PHP recursive file list (with interactive and visual FX)
Sam's Files
http://acc.jexiste.ch/JPN/RecurciveDIR12.RAR

1. How to ignore/avoid empty folders in this PHP script ?
2. How to sort files by filename (and, if possible, folders on top) ?
3. Is this MAILTO hidden tool still useful against the current Spam robots ?
Mysterious Ways - Hide Email Addresses from Spam Harvesters
4. Is my SpamPoison tag useful if I set it a#SP{display:none;} in the CSS ?
No contact link in their page ;(( Anti-Spam - Fight Back Against Spammers | bulk unsolicited unwanted junk email

Thanks and regards.

PS.
I got this error:
Upload Errors
RecursiveDIR12.ZIP:
Exceeds forum quota by 2.2 KB.


Expand|Select|Wrap|Line Numbers
  1. <?PHP
  2. //********************* RecurciveDIR 1.2 - Recursive PHP File List With Interactive & Visual Effects
  3. //error_reporting(1);
  4. function DirContent($Path,$Level=0){
  5.     $DEBUG=false;//***** For DEBUGGING
  6.     $ind=str_repeat(" ",$Level);
  7.     $FisrtLevel=$Level<1;
  8.     $Folders2Show=array("JPN");//***** CUSTOMIZE: Root Folders To Show
  9.     if($folder=opendir($Path)){
  10.         if($FisrtLevel){
  11.             echo "<H1>Sam's Files : ".date("Y.m.d")."</H1>\n";//Main Title
  12.         }
  13.         while(false!==($file=readdir($folder))){
  14.             $PathS=$Path."/".$file;
  15.             //Recursive Traitement For Sub-Folders
  16.             if(is_dir($Path."/".$file) && $file!='.' && $file!='..'){
  17.                 if((in_array($file,$Folders2Show) && $FisrtLevel) || !$FisrtLevel){
  18.                     $Fid=rand(100000,999999);
  19.                     $BoderW=max(1,3-$Level);
  20.                     $Hn=min(6,$Level+2);
  21.                     $atH=" id='h$Fid'";
  22.                     $inH2=substr($PathS,strrpos($PathS,"/")+1);
  23.                     echo $ind."<H$Hn $atH>".$inH2."</H$Hn>\n";
  24.                     $atD="style='border-width:".$BoderW."Px'";
  25.                     $atD.=" id='d".$Fid."' class='on'";
  26.                     echo $ind."<DIV ".$atD.">\n";
  27.                     DirContent($PathS,$Level+1);
  28.                     echo $ind."</DIV>\n";
  29.                 }
  30.             }
  31.             if(!is_dir($PathS) && $file!="." && $file!=".."){
  32.                 if(!$FisrtLevel){
  33.                     $Ext2Hide=array("PHP","HTM","HTML");           //Extensions To Hide = Viewable Files
  34.                     $Ext=strtoupper(substr($file,strrpos($file,".")+1));
  35.                     $Title="";
  36.                     if(in_array($Ext,$Ext2Hide)){
  37.                         $Filename=substr($file,0,strrpos($file,"."));//Hide The Extension
  38.                         //$Title="title=' View  ".$file."'";
  39.                     }else{
  40.                         $Filename=$file;                             //Show The Extension
  41.                         $Title="title=' Download  ".$file."'";
  42.                     }
  43.                     $href=$DEBUG?"#":$PathS;
  44.                     echo $ind."<P><a href='".$href."' $Title>".$Filename."</a></P>\n";//Link To The File
  45.                 }
  46.             }
  47.         }
  48.         closedir($folder);
  49.     }
  50. }
  51. //*************************************************************************************** Link List!
  52. function LinksLIST(){
  53.     $LinkFN="LiNKS.LOG";
  54. }
  55. ?>
  56. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  57. <html>
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  60. <title>Sam's Files</title>
  61. <style type="text/css">
  62. <!--
  63. HTML,*{margin:0Px;padding:0Px}
  64. BODY  {font-family:"Trebuchet MS",Arial,sans-serif;font-size:13Px;margin:20Px;cursor:default;}
  65. H1,H2,H3,H4,H5,H6   {margin-top:5Px;}
  66. H2,H3,H4,H5,H6      {cursor:pointer;}
  67. H1{font-size:20Px;margin-bottom:15Px}
  68. H2{font-size:17Px;}
  69. H3{font-size:16Px;}
  70. H4{font-size:15Px;}
  71. H5{font-size:14Px;}
  72. H6{font-size:13Px;}
  73. HR{height:1Px;color:#666666;}
  74. P {padding:4Px 0 0 0;}
  75. A {text-decoration:none;color:#0000CC;}
  76. A:hover {color:#993300;}
  77. DIV     {padding-left:8Px;border-color:#979748;border-left-style:solid;}
  78. DIV.on  {display:block;font-weight:normal}
  79. DIV.off {display:none; font-weight:bold ;}
  80. DIV.over{background-color:#F1F1E2;}
  81. DIV.out {}
  82. DIV#foot a#SP{display:none;}
  83. DIV#foot a{margin:0 0 0 9Px;vertical-align:top;}
  84. DIV#foot{font-size:14Px;text-align:right;border:solid #999999;border-width:1Px 0 0 0;margin-top:8Px}
  85. -->
  86. </style>
  87. <script language="JavaScript" type="text/javascript">
  88. <!--
  89. //Interactive Sub-Folders FX
  90. function SwitchDIV(){
  91.     var Elems=new Array("H2","H3","H4","H5","H6");//Elements To Affect Rollover FX
  92.     var HideS=" Hide this folder's content ! ";
  93.     var ShowS=" Show this folder's content ! ";
  94.     if(document.getElementsByTagName){
  95.         for(n=0;n<Elems.length;n++){
  96.             var el=document.getElementsByTagName(Elems[n]);
  97.             for(var i=0;i<el.length;i++){
  98.                 el[i].show=true;
  99.                 el[i].title=HideS;
  100.                 el[i].Fname=el[i].innerHTML;
  101.                 el[i].innerHTML="- "+el[i].Fname;
  102.                 el[i].cible=document.getElementById("d"+el[i].id.substr(1));//Sub-Folder's DIV
  103.                 el[i].onmouseover=function(){//Rollover FX
  104.                     if(this.show){
  105.                         this.cible.className="over";
  106.                     }
  107.                 }
  108.                 el[i].onmouseout=function(){//Rollout FX
  109.                     if(this.show){
  110.                         this.cible.className="out";
  111.                     }
  112.                 }
  113.                 el[i].onclick=function(){//Hide/Show Sub-Folders Content
  114.                     if(this.show){
  115.                         this.show=false;
  116.                         this.title=ShowS;
  117.                         this.cible.className="off";
  118.                         this.innerHTML="+ "+this.Fname;
  119.                     }else{
  120.                         this.show=true;
  121.                         this.title=HideS;
  122.                         this.cible.className="on over";
  123.                         this.innerHTML="- "+this.Fname;
  124.                     }
  125.                 }
  126.             }
  127.         }
  128.     }
  129. }
  130. //Blur All Links OnCLICK To Hide Dotted Borders
  131. function BlurLNK(){
  132.     var linkE=document.getElementsByTagName("a");
  133.     if(document.getElementsByTagName){
  134.         for(i=0;i<linkE.length;i++){
  135.             linkE[i].onclick=function(){this.blur();}
  136.         }
  137.     }
  138. }
  139. // -->
  140. </script>
  141. </head>
  142. <body onload="SwitchDIV();BlurLNK()">
  143.  
  144. <?PHP DirContent("."); ?>
  145.  
  146. <div id="foot">
  147.     <a href="mailto:%41%6c%66%2e%30%32%32%40%47%6d%61%69%6c%2e%63%6f%6d"> Comment ?! </a>
  148.     <a id="SP" href="http://french-145495639767.spampoison.com"><img src="http://pics4.inxhost.com/images/sticker.gif" border="0"/></a>
  149. </div>
  150. </body>
  151. </html>
Nov 23 '08 #1
0 1389

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks!...
13
by: could ildg | last post by:
I want to check if a folder named "foldername" is empty. I use os.listdir(foldername)== to do this, but it will be very slow if the folder has a lot of sub-files. Is there any efficient ways to do...
3
by: juli jul | last post by:
Hello, How can I read xml file but ignore the empty lines in it : is there some kind of function in C# that can read everything except for the empty lines? Thanks a lot! *** Sent via...
19
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple...
3
by: shorti | last post by:
I am looking for a way to insert into one table from another table but ignore duplicates (because the query will fail since the column I am inserting into is a unique index). RE: INSERT INTO...
6
by: Curious | last post by:
In a given folder, there are many sub-folders. Is there an easy way to find out those sub-folders that don't contain any file (empty sub- folders)? Is there such a utility in .NET?
1
by: Christian Heimes | last post by:
otaeris@o2.pl schrieb: As far as I remember the zip format it's not possible at all. Folders are created implicitly. The zip format doesn't support empty directories. Christian
4
by: cmrhema | last post by:
Hi All, I have created a website, which works successfully. Now for eg, imagine that the name of my website is ABC. And I have many folders inside it I have many aspx pages and their relevant .cs...
5
by: Per Juul Larsen | last post by:
Hi. My application creates empty libraries. How do I ensure that the user copies at least one or more picture files (.jpg) in each of the empty folders ? Result , no empty folders! regards pjl
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.