sachavdk
Jul 16 2005, 11:10 PM
I recentely installed IIS with PHP and MySQL on my pc (previous I used UniServer, but that doesn't matter here). But I had always to go to http://localhost/websiteiwanted or I had to create a shortcut on my desktop for every site so I decided to create an "overviewpage". It shows all the websites in your wwwroot with a link to them. If you have folders you don't want to be included, you extense the && check (but I'll explain this lateron) Here's the total code: CODE <ul> <table cellpadding="3" cellspacing="3" border="0" width="95%"> <? $dir=opendir('.'); $isdirtrue = false; while ($file = readdir($dir)){ if($file != '..' && $file !='.' && $file !=''){ if (is_dir($file)){ if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information') { $isdirtrue = true; echo '<tr><td>'; echo '<a href="'.$file.'/" target="_blank"> [ '.$file.' ]</a> '; echo '</td></tr>'; } } } } if ($isdirtrue == false) { echo "<div align='center'>- No projects -</div>"; } closedir($dir); clearstatcache(); ?></table></ul> Now I'll explain every step $dir=opendir('.'); opens the current folder. You could use .. to specify the folder one level up or ./folder/folder to open other folders. $isdirtrue = false; is going to check if the opened file is a directory lateron in the script, this just initializes it while ($file = readdir($dir)){ is going to read every "file" in the opened directory. Also . .. are files in the opened folder. This can be convenient sometimes but now they don't matter thats why I'm gonna use following code. To see that the opened file not . or .. is: if($file != '..' && $file !='.' && $file !=''){ if (is_dir($file)){ checks wheter the file is a directory. if it is one, we go to the next step if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information'){ here you can specify which folders don't participate in your projects list $isdirtrue = true; this sets the isdir to true because we have at least one project in the list. more explanation withing some lines echo '<tr><td>'; echo '<a href="'.$file.'/" target="_blank"> [ '.$file.' ]</a> '; echo '</td></tr>'; these are gonna write a link to the projectfolder if ($isdirtrue == false) { echo "<div align='center'>- No projects -</div>"; } now remember that we just set $isdirtrue to true because we had at least one project? at the beginning of the script we initialized it false. if there wouldn't have been a projectdirectory it would still be false and then it would give a message that there are no projects on your server. now very important are closedir($dir); and clearstatcache(); because if you don't use these, your cache memory will be left full of needless information. closedir() closes de directory you opened in the beginning of the script and clearstatcache() deletes all "temporary files" from the memory. Now that's it. I hope lots of people will follow my example and be more neater with their local webserver. 
Comment/Reply (w/o sign-up)
Klass
Jul 17 2005, 01:38 AM
so how does this work? I copied your code to notepad saved the file as test.html and nothing came up but: CODE [ '.$file.' ] '; echo ''; } } } } if ($isdirtrue == false) { echo " - No projects - "; } closedir($dir); clearstatcache(); ?> what do you do if you defined the inetpub folder to a different location other than C:\inetpub\wwwroot?
Comment/Reply (w/o sign-up)
rvalkass
Jul 17 2005, 08:56 AM
You need to save it as test.php not as a .html file, Klass. That should fix your problem. Also, I would like to know if it is possible to make something similar for Apache. Not just the normal directory listing, but one with links and some folders not displayed?
Comment/Reply (w/o sign-up)
sachavdk
Jul 17 2005, 02:53 PM
QUOTE(rvalkass @ Jul 17 2005, 10:56 AM) You need to save it as test.php not as a .html file, Klass. That should fix your problem. Also, I would like to know if it is possible to make something similar for Apache. Not just the normal directory listing, but one with links and some folders not displayed? Normally it could serve for Apache Servers. Run the script and see which directories are listed you don't want to if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information') IIS_Services, Config are directories I created to install PHP and MySQL, RECYCLER and System Volume Information are part of IIS and can be deleted with apache. IE. you have three directories. Two are project and one is some configuration dir. 1. MyConfiguration 2. Project1 3. Project2 Now you don't want dir MyConfiguration listed, then you simply have to replace if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information') by if ($file != 'MyConfiguration'). And for the links, normal it should display a link on every project this code takes care of that: CODE echo '<tr><td>'; echo '<a href="'.$file.'/" target="_blank"> [ '.$file.' ]</a> '; echo '</td></tr>'; if it shouldn't work, try this: CODE echo '<tr><td>'; echo '<a href="./'.$file.'/" target="_blank"> [ '.$file.' ]</a> '; echo '</td></tr>';
Comment/Reply (w/o sign-up)
Klass
Jul 17 2005, 04:36 PM
ok i sill don't understand your how to: 1. You do not tell us to save as a PHP file. 2. Where am I supposed to run this from? 3. Do I need to configure this for a directory since I do not use Inetpub defaults?
Comment/Reply (w/o sign-up)
sachavdk
Jul 17 2005, 05:29 PM
QUOTE(Klass @ Jul 17 2005, 06:36 PM) ok i sill don't understand your how to: 1. You do not tell us to save as a PHP file. 2. Where am I supposed to run this from? 3. Do I need to configure this for a directory since I do not use Inetpub defaults? 1. I've forgotten to tell it, sorry. 2. Wherever you want in your webroot. 3. It doesn't matter if you use Inetpub or some other. Imagine your wwwroot is "C:\MyDocuments\WWW\WEBSERVER\" and you have 5 webprojects in your webroot ie pro1, pro2, pro3, pro4 and pro5, each is located in "C:\MyDocuments\WWW\WEBSERVER\" so you have "C:\MyDocuments\WWW\WEBSERVER\pro1\" "C:\MyDocuments\WWW\WEBSERVER\pro2\" "C:\MyDocuments\WWW\WEBSERVER\pro3\" "C:\MyDocuments\WWW\WEBSERVER\pro4\" "C:\MyDocuments\WWW\WEBSERVER\pro5\" and maybe some configdir or a dir you dont want to have listed "C:\MyDocuments\WWW\WEBSERVER\whatever\" if you place the script in "C:\MyDocuments\WWW\WEBSERVER\" and you replace line 8 ( if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information')) by if ($file != 'whatever') the script will give you a list from all projects (pro1 to pro5). If you click one, the script will open the project (directory) in a new window. You can set this script whereever you like (ie you named this script list.php and set it in your rootdir) and go to http://pathofyourserver/list.phpTO EVERYONE WHO READS THIS:CODE if ($file != 'IIS_Services' && $file != 'RECYCLER' && $file != 'Config' && $file != 'System Volume Information') is just a line of code so dirs I don't want to be listed, are not listed. If there are no dirs you don't want to be listed change the line to CODE if ($file != '') this way all dirs are listed. I hope it's clear now to you.
Comment/Reply (w/o sign-up)
Adamrosso
Aug 8 2005, 10:10 AM
Great tutorial, i may need this in the future
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : making, webserver, directory, listing, helps, organise, webserver
- [aef] Most Recent Topics Listing Mod
on your Web-site pages (2)
Making Calculators with PHP
Some basic calculator scripts I made. (4) Yes, I made some basic calculators to use for simple math problems, nothing big. I'm a newbie at
php, so if I made something that could be short, long, I am sorry. lol Here is one for adding two
numbers. CODE Adding 2 numbers Type in the two numbers you'd like to add together.
+ Save that and name it add.php or add.html, it don't matter. In that
page, it is simply asking for 2 numbers to add. Next, create a page called add2.php, can't make
it html. CODE $_POST ; $_POST ; ?> Answer to + Answer to + ....
How To Make An Ultimate Game List.
If you're making a site on video games or such. (0) Hello. I am BuBBaG. You can call me Bubba for short. I'm going to show you how to make an
Ultimate Game List. First off, we need to make a database, we are going to call this database
`my_db`, leave out the `'s. Inside that database we will need to create a table called
`ugl'(Ultimate Game List, duh). To make the table, simply enter this in the Syntax. CODE
CREATE TABLE ugl ( System char(50), Game char(50), ) In the above code, it is stating we are
creating a table called ugl, with two columns, System, and Game. Next, we will need to make a form,
t....
Ftp In Visual Basic 6.0
Start making your FTP client using VB6 (3) Recently, I had a need to make a FTP client, since our webhosting FTP server was kind of exotic, and
very restrictive, and most of uploads, even though they reach 100% would crash... File would be
uploaded to a server, but FTP clients just froze upon completion, waiting for the 226 (OK) from FTP
server... So, I had to make my own, one who would not wait for 226, but instead, watch the file
pload progress... This tutorial is not fuly complete, in the sense that it does not offer COMPLETE
FTP client functionality (for example, I ddn't write the code for FTP download, ....
Making A Song In Fruity Loops Part Three
part three precusion (1) ok part three now which covers the precusions setup of the small song i built for this tutorial.
the nesecery files can be downloaded here the image below is included in the precusions folder as
it mught not be entierly visable within this post so shold you need it its there also the images
purpose is to enable you to see what i am refering to within this tutorial lateron. now what i
have done above is blackd out every pattern that has nothing to do with the precusion. so the
patterns displayed in light grey are the only patterns i will be refering to. ok lets b....
Making A Song In Fruity Loops Part 2
part 2 the second melody (0) ok i am going to attach the midi file againe incase you didnt get it from the first part in this
part i will demonstright how to create and insert the second mellody ok so you have your first
mellody wich is ecetially the comein chord as i call it. now open the midi file you put in your left
panel during the first tutorial and drag the mellody 2 © onto the pallet but click on pattern two
in the right site playlist box. now like in the first tutorial replace with sytrus. for this type
of mellody use something in the leads section of the plugin.for this you need to ....
Creating A Resume
10 Tips For Making A Resume (1) I've been working on my Resume for months now. Here is a summary of what I've learned: 1.
Avoid referring to yourself via 1st person or 3rd person terms. Rather than saying "I started this
job in" just say "Began job in"... Employers expect Resumes to be professional and avoid reference
to oneself; and instead speaking in an impersonal tone that presents
achievements/skills/experience/education without personalization. Avoid words like "I", "my", "he",
"she", etc. Leave out personal pronouns and only use the action words/verbs. This also includes
your Ob....
Making A One Page Does All Website In Phph
(2) Hello and Great Day or Night either one. Have you ever been to a site and seen a index page or any
page at all control everything such as index.php?do=home&action=logout something similar to the
above? Well I am going to show you how easy it is to make this all own your own, and only have to
use one web template or design to make it work. Before we get started you need to go ahead and find
the web design that you want to use. After you find the site you want to use go ahead and save
it... and save it like this so we can work together, ok! Note* We are going to be s....
Making a java based program
(3) Java GUI Making a Little Java Program Sec. 1: Imports and starting it off Sec. 2: Variables Sec.
3: Frame and Stuff Sec. 4: Declaring buttons Sec. 5: Adding buttons Sec. 6: Action Listening Sec. 7:
Using this for a learning experience Section 1 Now, let's think. What imports do we need? We
obviously need GUI imports. We also need the action Listener. So, let's declare this at the very
top: Code: CODE import java.awt.*; import java.awt.event.*; import javax.swing.*; That's
all we need to get all our supplies. Now to start us off. Skip a couple lines ....
Making The Popular Id Browsing For Your Site.
(17) Was just sitting and being bored but then I realized I could show how to create more or less popular
?id=page browsing. It's actually really easy. I know two ways how to do it. First one I learned
was checking the variable and if it's true including the text/file/anything needed and so on. It
was ok, but sometimes I just couldn't make it work so I switched to switch() function and
that's what I'm going to show you guys right now. So, I made a test page which contains the
code needed and here is its source. CODE Untitled Home - P....
Making A Dynamic Page On Blogspot
Using an external server to make your pages hosted on blogspot dynamic (5) Good morning everyone. Have you ever wondered how to allow your visitors to edit content on your
blog? Like adding a post straight off the page, adding a link, editing your profile etc. This will
be extremely useful if you want your visitors to contribute to your blog besides writing comments or
tagging. 1. Adding a post straight off the page. Go to blogger.com, login, select your blog. Go to
settings -> email. By enabling blog email, you can now add a post by simply sending an email to the
address you specified. The address should look something like: yourusername....
How To Protect A Directory From Being Viewed
without admin username and password (4) Well i ran across this script awhile back, and i am tired of storing it on my computer, so i am
going to post it here and whenever i need it i will come here and get it /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> hopefully Anyways, it is a
verry simple process just copy and paste this QUOTE if (($user) && ($passwort)) { # get url
$url = $DOCUMENT_ROOT . dirname($PHP_SELF) . "/.htpasswd"; # make .htaccess and .htpasswd
$htaccess_txt = "AuthType Basic" . "\n"; $htaccess_txt .= "AuthName \"protected area\"" . ....
Php Script To Make A Link List
From the list of the Directory Files (6) Well, it has been a while since I have added anything to the Tutorial Sectiion, so here is another
script for the members to enjoy. This one creates a list of links from the contents of the directory
which it is run from. For instance, if you run it from the public_html folder, then all the files
(not the Directores) are listed and linked so when you click on the link, that file is parsed and
output to the browser. Here is the code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
An XHTML 1.0 Strict Page to List the files in this directory ....
Making Interactive Cds With Flash
My second flash tutorial for Beginners (2) Im back again with what i think it would be an interesting tutorial for all of you guys who wants to
take flash out of the web and make really cool interactive CDS. First of all if all of you are
thinking right now: "this dude is wrong for making interactive cds you have to use macromedia
Director", well you are right macromedia director it's used to build interactive cds and dvds
among other things, but you can also make interactive cds with Flash, the thing is: if you want to
make a simple interactive CD you can totally do it with flash, of course Director brings ....
How To: Make A Simple Php Site
Making one file show up on all pages using php (21) I have looked all over the site and could not find anything that was like this simple, or just like
this at all.. For some people i know that you are using a basic HTML site...and having a big menu
if you want to add somthing you have to go into every one of the pages and add or remove or edit
what you want to do, but with somthing verry simple all you would have to do is edit one file, and
all of the pages that have the PHP script on them would suddenly change to what that one file is.
So to start off if you are planning on using this little tirck, the page that you a....
How To Stop Image Hot Linking
for a selected directory. (17) Those of you that don't know what is meant by 'hotlinking', it is when someone directly
links to an image on your site so it will display on their site. This is what is called
'bandwidth theft' and being as accounts here have a limit on bandwidth, your bandwidth limit
could be exceeded by someone else hotlinking to your images. As most users of cPanel will know,
there is an option to disable hotlinking of images in the "Site Management Tools" section.
However, this disables hotlinking to all directories, what if you only want to disable hotlinki....
Making Winrar Archives
and adding password to winrar archives (15) **** This tutorial will show you how to put files into .rar Archive and pass worded (if wanted)
**** What You Will Need Before continuing you will need a couple of thing, first of all you
need WINRAR , which is a very powerful archive manager. It can reduce size for you email
attachments, decompress RAR, ZIP and other types of files downloaded from the internet. You can get
winrar at http://www.rarlabs.com The other thing is that make sure your using Windows XP because
this is what I used to make this tutorial. I think it works with any other windows not....
Tutorial: Installing D-shoutbox For Ipb V1.2
Making your installation even easier (12) Over the course of the summer I have tried hard to install a shoutbox into a new forum I was
developing. I went to the Invisionalize forums and found several mods for shoutboxes, but none of
them seemed to work. I first tried to install the D-Shoutbox, but upon this first try, I was
unsuccessful. Eventually, after much frustration, and trying other mods, which didn't seem to
stack up to Dean's features, I was determined to make it work. For some, editing your files (to
the newbie that is) can be difficult, with everything looking like a foreign language (basi....
Making Shadows Without Images
(4) Im going to show you very simply how to create boxes with Shadows using div tags and css, no images
needed, meaning fat pageload times! /biggrin.gif' border='0' style='vertical-align:middle'
alt='biggrin.gif' /> You simple need to create two layers, one behind the other, the one behind
will have a top and left margin on 20px, the one infront 10px, set teh background colour of the one
behing darker than teh one infront, you should end up with something like this: Here is th html
to create this effect: CODE Its as simple as that, two divtags, a bit of cs....
Making A Website
Also Some Dos and Don'ts (6) I had originally had this posted on my domain at nevernormal.com, and thought that you guys could
use it here as well. Granted, this is geared to the uber newbie, so don't razz me if I
don't suggest the most advanced in web design. lol So, you want to make a website? 1.
First, think about what you want your site to be about. There are fanfic sites, like Drastic
Measures and fanfiction.net ; cliques or clubs, like the BtVS Writers' Guild ; or, if you
want, you could have a general site, whether it be about a show/movie you like, or even just about y....
Meta Tag Information
Tips 2 optimize listing in Search Engine (2) i know many of u here get this prob ., as ur site doesnt appear even after months /smile.gif'
border='0' style='vertical-align:middle' alt='smile.gif' /> i have a fer tips , am sure most of u
kno it Google sents out whats called a robot that looks over every thing on your site once thats
done your site gets listed. However where you are on that listing depends on way to many things to
go into here. The simplest thing to do is make sure you do Meta tags. another thing is to ad full
alt names to your images...robots like those..dont use the same name over and over a....
Looking for making, webserver, directory, listing, helps, organise, webserver
|
Searching Video's for making, webserver, directory, listing, helps, organise, webserver
See Also,
|
advertisement
|
|