Jump to content

simple idea for a php script...


kobayashi_one

Recommended Posts

Hi,
I want to make a site where you can add flash applets. For this I need to simple codes, but I'm a PHP newbie, so I need some help.
1: I need a code producing a link list of all files in a directory on my server.
2: I need a code that makes a form where you can enter the flash applet url, flash applet name, a applet catergory (example: Movies), and where you can add a link to the creator of the applet. When you submit this form, a website should be created with the applet in the specific category/directory.

I don't know how to make these codes.. has someone got the codes I need?
Link to comment
https://forums.phpfreaks.com/topic/31590-simple-idea-for-a-php-script/
Share on other sites

  • 3 weeks later...
Hey bud, try this code for listing the files in your directory. Hope it works for you. I put some comments in to help you sort out what is happening. You should just be able to copy and paste this code into your web page.

Scot McConnaughay

<?php
// current directory
$root = "." ;
// set mydir as the current directory
$mydir = opendir($root);
// loop until the directory is empty
while(false !== ($file = readdir($mydir))){
// put each file into an array
if(!is_dir($file)){
$fileList[] = $file;
}
}
closedir($mydir);

natsort($fileList);

// set up the variable for displaying the list
$display = "data=";
// seperate each file in the list with a '#' sign
foreach($fileList as $file){
$display .= urlencode($file)."#";
}
// output the resulting list.
echo $display;
?>
  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.