Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




List Contents Of A Folder, Make List Of Links


Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
List Db Contents
can someone help me make a script that will list the information in one colum in my table! See each clan I have has an ID, and CEO and bla bla bla! But what I want done is it to only show the name of the clan in A dropdown menu. So that when users are signing up they can select the clan they want and it well ya you know puts the name beside theres in the table. But can someone make me a script to list all the clans Names and only names not ID, Ceos, and all that other stuff. Code:

List Subjects That Are Links
I want to list the subjects names which link to the whole bulletin, but am having trouble.

   while ($numofsubs = mysql_fetch_array($result))
   { echo ('<td align=left><a href="viewspecificbull.php?id=' . $numofsubs['Subject'] . '">[/url]</td></br>'); }

List Of Subjects Which Are Links For Bulletins
I am trying to list all the subjects of bulletins for a logged on user. Code:

Folder List With Pagination
I'm looing for a simple PHP file list program, that will show all the
files in a folder, but show them in batchs of 10 - 15..

How Does One Get A List Of All Files In A Folder?
need a list of all files (i have like 5k or so) in a folder, I need to add there names to a table

I am doing this so i can compare two tables

table 1. comments added to uploaded pics -finished pictures-
table 2. no comments added yet to uploaded pics (so they can be commented on GET IT?)  -unfinished pictures-

All the pictures are in a single folder for the time being i'm going to be making a form based on the pictures that are on table 2 so that they can have comments and titles and file name added to table 1 (to be done still) but i need to know all the file names for the folder in question, i guess i could do it via cmd line ls or something like that, i'll get back to you.

Folder List Drop-Down
I am developing a PHP/MySQL project and as part of my initial setup and configuration scripts, the users can select a skin for the application, and a variable value ($skin) is updated to set the current skin, this works ok on it's own, but currently the user must manually type the skin name in a free-text box.

Ideally this needs to be a drop-down option box, and I would like this to be populated by listing the sub-folders within the '/skins' folder, so that it's always up to date. The folder structure looks like this:

/skins
/skins/skin1
/skins/skin2
/skins/skin3

How can I use PHP to generate a list of the current sub-directories in 'skins' and populate the drop-down list?

Retrieving Contents Of Select List On Form Submit
On an HTML form, I have a select list that is fed dynamically with
detail records when the master record is displayed on the form.

There is also a second lookup list, and want to allow the user to
dynamically select from this list and add to the first list. I also
want the user to be able to dynamically remove from and reorder the
first list. I think I can do all of this with JavaScript.

The question I have, is how can I retrieve the contents of the first
list when the user submits the form? I need to get it back into a php
array so I can update and add the proper database records.

Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.

I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).

Display A List Of Files In A Folder
How do you display a list of files in a folder and then delete one by clicking on it?

Is It Possible To Make This? (Online Signup List)
I'm trying to create an online signup list for jobs in a "restaurant" type thing.  I've got the part where I can get users to login, signup for certain jobs and when the list is full, they can't sign up anymore.  The problem I'm now having is, I now have to create the MySQL table and the php signup page for every day of the year. Is there an easier way to create this? 

What I was thinking was if it was possible to make one signup list and have a constant variable that changes ... actually I have no clue how to get around this.  Could anyone point me in the right direction?  or should I just create all the pages manually, it's possible and I'd have to do it because the project is kinda due soon -_-.

Alphabetizing A List Of Links - Click A Link And It's Not Alphabetized Anymore??
I am editing a site, I didn't make it, and I have a list of links created from a mysql db.  I am sending the info from mysql in asc order, but this only works the first time the page comes up.  If you click on a link in the list, it appears to revert back to being ordered by the date entered and stays that way through subsequent clicks.  A point in the right direction on how to make my list stay alphabetized would be very good. 

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

Easy Way To Make "pages" From A Database List
If I list all the rows in a database and "LIMIT 20", how do I make it so I can go to, the next 20 rows? Say if I have 50 rows, and only want to show 20 per a page?

Getting And Using Contents In A Folder
I want to make a photogallery/slideshow with PHP...

The 'gallery/slideshow' would show up inside a new window.
basically, I just want links with possibility to go:

- forward
- back
- to the very beginning
- to the very end
- away (close the window)

Can I use PHP to determine the contents of the folder with the pictures and then use variables to determine which photo to show, and what URL's should be generates for the arrows? So each folder with a series of photographs would have one PHP file and the pictures themselves in them (it's not a problem to rename them).

Should be simple enough, but I'm just starting out with PHP, and I'd like to have something working as soon as possible... the website I'm working on is about to launch soon (my first 'commercial' web project :) ), and this is about the only thing left that I still have to sort out how to do...

Getting Contents Of Folder
I've made half of the code for a little "hosting" site for a few of the members of my site. Their files are uploaded to /login/<username>/

I'm now stuck as to how to show the contents of the folder in a page. I think the use of fopen() is needed, however the php website is a little confusing.

Delete Folder And Its Contents
is there any way of deleteing a folder and all of its contents using PHP?

Deleting Folder And Contents With PHP
Im using this code to delete a folder using my script but it says Directory not empty. What code could i use that will delete the folder, subfolders, and all its contents.

$currentdir = getcwd();
$directory="$currentdir/users/$_COOKIE[username]/albums/$_GET[albumname]";
rmdir($directory);

Folder Contents Function?
I'm looking for a function that puts the contents of a folder (the file names) into an array. Is there such a beast? For instance, if there is a folder off of my root called /tips/, and I want to list the files that are in it, such as tip1.txt, tip2.txt, etc.

Copy Entire Contents Of A Folder To Another
Situation:

I am creating a folder based on input from a form and then creating an images folder underneath that -- that works great and I can read and write to the newly created folders AS LONG AS IT IS ONE FILE AT A TIME!!!

What I would like to do:

I would like to copy the contents of an entire folder over to one of the newly created folders ALL AT ONCE -- or in a loop -- which is what I am trying to do but keep getting denied.

My code as it is now:
if ($handle = opendir("$sourcedir")) {
echo "Directory handle: $handle<br><br>";
echo "Files:<br><br>";
while (false !== ($files = readdir($handle))) {
if ($files != "." && $files != "..") {
if (!copy($files, $imagepath)) {
echo "failed to copy $files into $imagepath<br><br>";
}
}
}
closedir($handle);
}

all of the variables are working fine... it goes through the loop just fine -- I know this because it prints out the error for every file in the folder... it just won't copy the files over to the new folder while in this loop.

Here is the beginning of the error messages:
Directory handle: Resource id #2
Files:
failed to copy step_c1.gif into /htdocs/www/schemes/adfasa/images
failed to copy step_b1.gif into /htdocs/www/schemes/adfasa/images
failed to copy step_a1.gif into /htdocs/www/schemes/adfasa/images

by the way: adfasa is the folder name brought in by the form and images is the folder I create underneath it.

Is this something that is possible to do in a loop? If so, what is wrong with this one. If not, how is something like this done?

Of course since I know the files that are in the folder I want to copy from I could just go ahead and copy them ONE by ONE but that doesn't seem to be very efficient.

Syncronizer - Synchornize Folder Contents
is there anyway to sync to folders Contents between two Computers in PHP...

How Do You Make Links Like: Something?id=3
Does anyone know where i can find a tutorial about how to make dynamic pages wtih id links.

Make Links Active
Im just wondering if there is anyway to automatically make any urls in my page content, into clickable links. Basically I have a small forum I built, and I want to make any URL the user enters, into a clickable link. So if I had www.google.com as plain text, then it would make it into a clickable link.

How To Make Data Pulled Into Links?
i seem to be having trouble trying  to make the hacks that are pulled down into a link for exammple when you select a category it loads all the hacks that are associated with that category, now i need those hacks linkable so that they have there own page for example this will be the link hacks.php?hacksid=hacksid (hacksid being what ever that hack id is) Code:

How To Make Display Links From Mysql Database?
i have the following problem and i am breaking my mind on it:
I have a mysql database with (id,title,topic,body) in the database i have
stored some documents.
How can i display a link with only the title of the document stored?(easy
one) but...
I want to view the whole document in the same page!
Let me explain in code:

<?php
$ip = "localhost";
$user = "kostas";
$password = "kostas";
$basename = "test";
$table ="docs";
$db = mysql_connect($ip, $user, $password);
mysql_select_db($basename,$db);
$result1= mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT 5 ");
$myrow = mysql_fetch_array($result1);
$title = $myrow["title"];
$intro = $myrow["intro"];
$body = $myrow["body"];
?>

How Do You Make The Contents Of A Text Box Remain, Even After Clicking Send, With Errors ?
How do you make the contents of a text box remain, even after clicking send, with errors?

At the moment, the visitor inputs a load of text into the comments box, but if they click send and there's errors in other fields on the page, the comments box goes blank and they have to start all over again ...

How To Automatically Make URLs Posted In A Forum Active Links?
I've been working on modifying a forum script for some time now and its almost ready to go. You can test it at http://www.designlaunchpad.com/forum if you like. The one additional feature I want to implement is the automatic creation of a link when someone posts a URL in their message. Most forums have this, is it that tough to add in? I'm pretty comfortable editing PHP and understanding what is happening where but I suck at authoring it. I checked the manual at php.net and tried searching this forum and google but keep running into dead ends. So can someone offer me some suggestions or point me toward some help?

Using List
when my form is loaded i populate a list with a database query. now when user selects a value from the list. on "onChange" another query runs and other fields on the form are populated according to the value selected by the user but at this time when page is loaded again and the fields on the form are filld. every thing goes write but the select list doesn't have the same value selected that was selected by the user...the selected list shows the default valuse selected instead.

i want to know that how can we do this that when we select a value from the list and page is populated using this vale and refreshed then again i want to see the selected value in the list box not the dafault value.

Mp3 List
I can't figure why I can't list only mp3 files with this code :

<?php
$dir = opendir(".");
while($file = readdir($dir)) {
$ext = getFileExtension($file);
if ($ext = "mp3") {
echo "<a href=" .$file.">".$file;
echo "<p>";
}
}
closedir($dir);

function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}

?>

Buddy List
I have a community, now it´s time to upgrade and make a buddy list. Ive started wtih the file that ask´s the other member for a relation. The code looks like this PHP Code:

Problems With List()
I am having some problems with the list() function. Here is some code:

<?

$USERDB = fopen("users.db", "r");

while ($line = fgets ($USERDB, 4096))
{
list ($name, $occupation, $favcolor) = split ("|", $line);

print ("Name: $name<br>");
print ("Job: $occupation<br>");
print ("Favorite Color: $favcolor<br>");
}

fclose ($USERDB);

?>

And here is whats in the text file: Van Tate|Software Engineer|Green

Now...when I execute the script I get this error: Warning: bad regular expression for split() in /var/www/html/v2/getusers.php on line 7.

List Constants
A little embarrassing but: is there any easy way to echo (the name and
value of ) all defined constants?

Drop Down List
I want to read a directory for available files and then get the filenames and put them in a drop down list. Whatever the user will select will be the value of the variable $selected. I already found the code to read directories: Code:

Loop Through A List
I want to loop through a list and display it in a table with three columns per row, yet haven't had much luck in doing so. I was thinking if would be something like so Quote:

for ($x = 0; $x < mysql_num_rows($query); $x++) {
if ($x / 3) { ?>
<tr> <? } ?><td> Blah </td></tr></table>

Well, that's as much as I know so far.

Add Number In List
I am outputing a list of 10 values.

10, 20, 30, 40, etc

I can add 15 to one of the values then reorder the values from smallest
to highest but i want to update every single value and assign it values
increamenting by 10

so after the update the second number of 20 and add 15 I get

10, 30, 35, 40

now i want to re output the values above as

10, 20, 30, 40

Php Mailing List
Can anyone point me to a php script that stores email addresses into a
txt file?

The purpose for this is for a mailing list, ideally if a user wanted to
unsubscribe the email would be removed from the text file.

PHP Link List
On a page from Thredz (http://www.thredziii.com) I saw a script (it's not on anymore...cause he didn't want the script to be on his page) and I love it...

It's a script that makes it possible that on a page links are sorted ALPHABETICALLY with the first letter of the "URL name"... (take a look on Thredz' site to c what I mean,K?)

Then people got 2 have the abbility to fill in a small form, ON THE SAME PAGE WHERE THE LINKS ARE ON, where they fill in 2 fields;
#1 = Name of the Site ($sitename)
#2 = URL of the site ($url)

When they fill out it form I want the PHP-script to put the information away as a link (in a *.txt-file...if possible)
<A href="$url" target="_blank">"$sitename"</A><br>
(something like this??? I'm not sure......)
These links have to be sorted alphabetically (on the site's name,$sitename...

I don't know how this works or how I have to make something like this... Could somebody please help me and give me a bit of help with it? Some explaining would be gr8 but the script written for me is the best wish I have.

Dropdown List
I have a Dropdown list with Select with 1, 2, 3, 4, after select on of them it bust to refresh the page to what you select but it don't do it. PHP Code:

Getting List Of Newsgroups Via Php
I am trying to write a PHP script that will download a list of all
the newsgroups on a news server and put them into a MySQL database.
I bought a $50 book that had some NNTP examples in it, but none of
them show how to just download the groups, not the articles. I tried
on my own for about 2 hours with no luck. If someone can point me in
the right direction to download the group list using PHP, I think I
can figure out how to write it to a database.

FTP List Problem
I used ftp_rawlist, not ftp_list.
[color=blue]
> I used ftp_list and ftp_nlist. Both of them worked when the target is Sun
> or Linux machine. However, it didn't work when the destination is VXWorks
> (embedded platform). The version of php I am using is 4.3.2. According[/color]
to[color=blue]
> my search on google that problems for ftp_list and ftp_nlist for some
> platforms were fixed in 4.3.
>
> If I manually ftp to the VXWorks, I could use the "dir" or "ls" to see the
> listing at the destination.
>[/color]

List Certain Files In A Dir
I am working on a news script were my members can post what they are currently working on. I have a dir were all of there images are going to be uploaded, and I need to know if the following is possable to do.

$username = the members name selected from the database
$projname = the projects name selected from the database

What I want to do is select only images with the filename containing the info. The filenames are like this:

TheBlackshinobi_3dmountain_1.jpg
TheBlackshinobi_3dmountain_2.jpg
TheBlackshinobi_3dmountain_3.jpg

Php And Drop Down List
I am coding an email form on a site. A user enters their name and contact email and then selects from a drop down list to which particular email the message should be sent: User1, User2, User3. Then the user types out a message and hits submit. My problem is that I am unsure as to how to grab the selection in the drop down list and pull the selection and place it like this: "$selection@domain.com". Here is the php code:

PHP Shortand List
Is there a place where I can find a list of all the shorthand/shortcuts in PHP's syntax. IE: $_POST, $counter++, etc? Anyone know?

Getting A List Of Newsgroups With PHP
Does anybody know of a quick and dirty way that I can connect to a news
server, retrieve a list of all newsgroups beginning with alt. (or comp., or
blah., or wibble., doesn't really matter), and also the newsgroup
descriptions, and then dump them all in an html file?

Php Mailing List
Is it possible to implement a mailing list using PHP?. I know I could
maintain a list of emails addresses in a db and send mail to them through my
website, but how can I get true mailing list behaviour where emails are sent
to a particular address (like mailinglist@mydomain.com) and then distributed
to all of the email addresses?.

PHP For A Mailing List
I' trying to develop a mailing list system in php and mysql.

While(list => Checkboxes
I wanted to print out checkboxes for those which are checked when form is being submitted. Whilst, this is my function: PHP Code:

Select List
I'm creating a form that has three select lists. The first one has two values EMAIL and SMS. What I want to do is have the two other select lists (named EMAIL and SMS) work so that if EMAIL is selected only e-mail select list can be altered and vice versa with the SMS.

How can I do this? I know to use disabled in <select> -tag, but how can I check the what the value is (and the value changes) and then act acording to it?


Copyright © 2005-08 www.BigResource.com, All rights reserved