Location: PHPKode > projects > NetLink > netlink_os/cms_files.php
<table summary='files' border='0' style='border:2px solid black;' align='center'>
      <tr>
        <td colspan='5' align='center'>
          <table summary='cms' border='0' class='cms' style="margin:0px;border:0; border-collapse: collapse;">
            <tr>
              <td align='center' class='cms_title' colspan='6'>
                <?php echo "Pages for $login"; ?> (*.html, *.xml, *.js)
              </td>
            </tr>
			<!--Table Headers-->
            <tr>
              <th>
                Filename
              </th>
			  <th width='300px;'>
                Last Modification
              </th>
              <th width='75x;'>
                Size
              </th>
              <th align='left' width='30px;'>
                Edit
              </th>
              <th align='left' width='30px;'>
                Rename
              </th>
              <th width='30px;'>
                Delete
              </th>
            </tr>
            <?php
		#REQUIRE FOR ALL 3 SECTIONS!!!!
		require("File_Size.php");
		#DO NOT INCLUDE ANYWHERE ELSE!!!!
                $dir = "Users/$login/"; 
                $tr="#c0c0c0";
		$flag = false;
                if (is_dir($dir))
                {
       		  if ($handle = opendir($dir))
		  {
		    while (false !== ($file = readdir($handle))) 
		    {
       		      if ($file != "." && $file != "..") 
		      {
		        $create="";
			$mod="";
			$fs= File_Size($login,$file);
			$tail=strtolower(substr($file, -2));
			
                        #Main IF Statement
			/*
			* To be used when sorting files
			* and to not list the menu 
			* javascript!
			*/
			if ($file!="menu.js")
			{
			  #File Modification
			  /*
			  * Display the last modification time of
			  * the file for the user. This is useful
			  * for when the user wants to do some
			  * major upadtes
			  */
			  $mod=date ("m/d/y h:i ", filemtime("Users/$login/$file"));
			  if (date("H",filemtime("Users/$login/$file")) >= 12)
			    $mod.="PM";
			  else
			    $mod.="AM";
			  #ASCII Text Binary File Filter
			  /*
			  * Sort the FILES by the extention of the website page extentions
			  * covers:
			  *	-HTML & HTM, JavaScript, PHP, XSL, XML, CSS, PL, SVG
			  */
			  if ((($tail=="js")||($tail=="ml")||($tail=="sl")||($tail=="vg")||($tail=="hp")||($tail=="tm")||($tail=="pl")||($tail=="ss"))&&($file!="www.css"))
			  { 
			    echo "<tr bgcolor='$tr' onmouseover='color_on(this)' onmouseout='color_off(this, \"$tr\");'>";
			    echo "\n<td><a href='Users/$login/$file' target='_blank'>$file</a></td>";
			    echo "\n<!--File Modification Time for $file-->";
			    echo "\n<td>$mod</td>";
			    echo "\n<!--File Size for $file-->";
			    echo "\n<td>$fs</td>";
			    echo "\n<td><a href='egap.php?file=$file'>";
			    
			    if ($pref=='t')
            echo "Edit";
          elseif ($pref=='i')			    
            echo "<img src='Images/edit.gif' border='0'/>";
          elseif ($pref=='ti')
            echo "<img src='Images/edit.gif' border='0'/><br/><small>Edit</small>";
			    
			    echo "</a></td>";
			    #Loop for TR colors
			    if ($tr=="#c0c0c0")
			      $tr="#ffffff";
			    elseif ($tr=="#ffffff")
			      $tr="#c0c0c0";
			    $flag = true;
												
												
			  }
			  #Can't Delete or rename Index.html
			  /*
			  * User CAN NOT DELETE or RENAME index.html.
                          * if they do, the website will not load correctly
			  * for the surfer/visior and if the file does
			  * not load correctly, then the user will complain
			  * on why the file isn't loading and they
			  * will not understand. This just eliminates
			  * the hassle of the INDEX.HTML file management
			  */
			  if ($file=="index.html")
			  {
			  echo "<td style='text-align: center;'>";
			    if ($pref=='t')
              echo "<s title=\"Sorry. Can't Rename index.html\">Rename</s>";
            elseif ($pref=='i')
              echo "<img src='Images/rename_g.gif' border='0' title=\"Sorry. Can't Rename index.html\"/>";
            elseif ($pref=='ti')
              echo "<img src='Images/rename_g.gif' border='0' title=\"Sorry. Can't Rename index.html\"/><br/><small><s>Rename</s></small>";
             
            echo "</td>";
			     echo "<td style='text-align: center;'>";
												
            if ($pref=='t')
              echo "<s title=\"Sorry. Can't Delete index.html\">Delete</s>";
            elseif ($pref=='i')
              echo "<img src='Images/delete_g.gif' border='0' alt='' title=\"Sorry. Can't Delete index.html\"/>";
            elseif ($pref=='ti')
              echo "<img src='Images/delete_g.gif' border='0' title=\"Sorry. Can't Delete index.html\"/><br/><small><s>Delete</s></small>";
            
            echo "</td>";
            echo "</tr>\n";
			  }
			  #for all of the other files
			  elseif ((($tail=="js")||($tail=="ml")||($tail=="sl")||($tail=="vg")||($tail=="tm")||($tail=="hp")||($tail=="pl")||($tail=="ss"))&&(($file!="www.css")&&($file!="index.html")))
	           	  {
			     echo "<td style='text-align: center;'><a href='?id=rename&file=$file'>";
            if ($pref=='t')
              echo "Rename";
            elseif ($pref=='i')
              echo "<img src='Images/rename.gif' border='0'/>";
            elseif ($pref=='ti')
              echo "<img src='Images/rename.gif' border='0'/><br/><small>Rename</small>";
             
            echo "</a></td>";
			     echo "<td style='text-align: center;'><a href='?id=delete&file=$file'>";
												
            if ($pref=='t')
              echo "Delete";
            elseif ($pref=='i')
              echo "<img src='Images/delete.gif' border='0'/>";
            elseif ($pref=='ti')
              echo "<img src='Images/delete.gif' border='0'/><br/><small>Delete</small>";
            
            echo "</a></td>";
            echo "</tr>\n";
			  }
			} 
	              }
		    }
	  	  }
		}
		#ELSE parameter
		/*
		* If no files exist (which at least
		* ONE should), then display this
		* error of "No Files Exist Yet!",
		* but this shouldn't be a problem 
		* because INDEX.HTML will exist!
		*/
                if ($flag==false)
		 echo "<tr bgcolor='$tr'><td colspan='6'><i>No Files Exist Yet!</td></tr>";
              ?>
          </table>
          <div class='add'>
            <b>ADD:</b> <a href='?id=add_page'>Add a Page</a> <!--<b>|</b> <a href='add.php?id=f'>Add a Folder</a>--> <b>|</b> <a href='?id=upload'>Upload a Page</a>
          </div>
        </td>
      </tr>
    </table>
Return current item: NetLink