Read Latest Entries..: (Post #11) by BuffaloHELP on Aug 25 2006, 04:30 AM. (Line Breaks Removed)
By the way you can write asHTMLecho "<a href='$path$narray[$i]'>$narray[$i]</a><br/>";and still be sufficient. As long as $path is correct you do not need char(34) since a single quote will suffice.And when only one set of double quotes are used, no need to use periods to separate variables.But the question I have is... read more.
The following code displays the files of folder...but they are displaced by the order of adding... i want to sord the files / folders alphabetically and sord by accending order and by decending order.. can some one help me.
CODE
<? $path = ""; $dir_handle = @opendir($path) or die("Unable to open $path"); echo "Directory Listing of $path<br/>"; while($file = readdir($dir_handle)) { if(is_dir($file)) { continue; }
Both of those scripts look like they will work to sort in ascending order. To sort the array in descending order, use the function rsort() instead of sort(). Everything else should remain the same.
All it needs now is a form to select the directory and a radio button set to select ascending or descending sort order. Then an If statement to sort in the chosen order. And a set of html ul tags and li tags. And a class to hook the styling to for the html / css and you are all set.
I prefer a single page script / form method personally.
i dont mean to bother but it still shows blank screen... for example i have a folder "test" in htdocs.. and i gave the path
CODE
$path = "test";
but it shows blank screen.. and if i give any wrong name of the folder which doesnt even exists in htdocs , it still shows blank page, even it should say "Unable to open ..." im trying to find the problem but cant..
QUOTE(mole2k9 @ May 1 2006, 03:10 PM)
Opps mean to use rsort also made 1 other change , chnage$sfile to $narray[$i] in, echo "<a href=".chr(34).$path.$narray[$i].chr(34).">".$narray[$i]."</a><br/>"; this is tested and works,
Have a look at the script I sent to you and you will notice there is a line in in which sets the path to "./". This references the path which the script is run from. Modify this path to include the name of the directory on a relative basis.
CODE
$path = "./test/"
Also, if you are making changes to the script and want further advise, I would reccomend including a copy of the actual code which is not working. The sample you list above does not have any directory in it so I am curious about whether you actually have a valid path in the source code.
Also, the echo statement is commented out in the listing you display.
CODE
//echo "<a href='$path/$file'>$file</a><br/>";
Check to make sure the commenting slashes are removed before running the script. With these slashes in place, the information is not being sent to the Browser. Might explain the blank page.
thanks..i have edited a lil bit the above code..now it displays all the files and folders within a directory...but the problem is that , for example i have index.php file in that directory , it shows that index.php file also in the list..i want that it should show every file but NOT index.php.. what i should do for that ??
CODE
<?php $path = "./"; $narray=array(); $dir_handle = @opendir($path) or die("Unable to open $path"); echo "Directory Listing of $path<br/>"; $i=0; while($file = readdir($dir_handle)) { if($file != '.' && $file != '..') { //echo "<a href='$path/$file'>$file</a><br/>"; $narray[$i]=$file; $i++; } } sort($narray);
Place this right before echo (in my case) solved my issue. The problem was that the replacing string had to have a value. I left it as just " " and it wasn't working.
Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
i have found a few download scripts but they would not work for sound files for some reason. also
this will not be used for allowing downloading of illegal or riped music, what i will be using this
script for is i'm making a site for my church and the pastor wants to be able to recored the
services and then have me upload them to the site so that the church members can download them for
what ever reason. If some one could tell me how to make one or could show me a plac....
I am trying to do a simple thing. I want to display all the images of a directory on a single page
with the checkbox next to each image, so that i can select multi images and i can delete selected
images. Following few lines of code display the images of a directory.. i need help to put the
check boxes with each image. and I dont understand how can i select multi images with check box and
then delete them. I hope someone can help. thanks. CODE <?php $path = "./";
$dir_handle = @opendir($path) or die("Unable to open folde....
Alright I am trying to have a PHP FTP Upload Form that allows the user to create the directory
folder for where they want to upload there files to. example: Main Directory: vainsoft.com There
directory: vainsoft.com/modeling or vainsoft.com/photography But I dont want them to be able to
upload things into the main directory, only sub-directories, is that possible with this coding that
I have: //uses $_FILES global array //see manual for older PHP version info //This
function will be used to get the extension from the filename function get_extension($fi....
Hi all, I am sure all of you are great programers but First i am no code programmer i am just
trying to learn to run my sites, will the problem is i got a code from the web to protect my files
,1st i want to know how to work it out then i will try other things but can't let it go without
a fight thanx all php: CODE <?php if ( ! defined( 'myname' )
) { print "You cannot access this file directly."; exit(); }
customer data here ?> now i can't access my files what is the meth....
Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
want make an interface (in php) that write the data in a .html extension file to show to everybody
the html page and just the php interface is to the content manager. thanks in advance ....
This is the Trap17 edition of the Hosted Members Directory. A script initially written by me for the
Astahost forums. The script has gone through many a changes and is currently in version 4 which
includes the following features:- > Listing of hosted members. > Listing of the websites of the
hosted members. > Validation of the websites (whether the site is suspended, working or not not
working, etc) > Save/Load result to/from database. > Multithreaded for faster operation. > Status
messages, images and progress bar to keep you informed of the process. Link to the Scrip....
I made a simple flat file text editor, that can show you probably how simple it is to use forms with
php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
are. Here's the file with comments. I think that HTML really doesn't need some more
explaining. CODE Title: <br /> <input type="text"
name="title" size="53"> <br /> Text: <br />
<textarea nam....
Some user posted a similar problem i had when i tried to figure out how to update content on my
website in less work as possible. This is just part of the "big" plan i have for my site but it can
be helpfull to you guys if you like FlatFile. I hope that mod's don't mind me posting the
same code here and on their forums, couse if they do i'll delete it from their forums
/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So
here's the situation. Let's say you have a folder called 'myfilesdirectory' on your
s....
Hello everyone! I am in need of some code a for a signature generator I am making. I am using
BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a
html file that will have the user say what is on the sig! But now, I need help getting the form
data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells
the php file what text will go on the sig. But how can I make the form data in the html file go into
the text file so it will go onto the sig? You might want to read BuffaloHELP&....
Ok lets say i have a config.php file, i want to edit something without open it, i know every line
number and that, now how would i do this? I will show you a example: CODE <?php
$CONFIG['user'] = 'root';
$CONFIG['server'] = 'localhost';
$CONFIG['pass'] = '******';
$CONFIG['db'] = '******';
$CONFIG['install'] = '1';
$CONFIG['lang'] ....
Hi all ive got a small and simple (for the moment atleast /unsure.gif"
style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
listing script in php as follows CODE $dir = "."; $num = 0; $file =
scandir($dir); while($file = scandir($dir)){ echo
$file[$num]; echo "<BR>"; $num = $num + 1;
}; the concept is simple enough, the directory to start with is the current one, so scan this
directory and wh....
I want to learn php and I am already on the first steps to doing it. I have set up my server using
easyPHP as well as XAMPP which is a package containing FileZilla, Apache and MySQL. Other than
easyPHP, XAMPP and MySQL, what other softwares are required to be set up for me to successfully
learn how to program with PHP?....
hi, could someone please help me with this? I have some files in a directory and i want to know how
i can randomly display link/s to one or more of the files in my directory for download. But it must
not at any time display index.php which is also in the directory with the downloads. Thanks in
advance for any help given /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
alt="unsure.gif" />....
ok i wus fantastico to install my nuke...it asked me to give it a name for its directory so ive put
down "nuke" so to get to my site ud have to go to www.boaw.trap17.com/"nuke" but now i want to
change nuke into something else more related to the site...i was wondering if any1 can tell me the
best way to do that...thanks....
I want to display the contents of a directory.. i have the following code.. It gives the output in
one column only... like file1 file2 file3 file4 . . . . . Since there are lot of files so this
column gets very long..i want to display the x number of files in each column.. like if there are 22
files.. then file 1 file 11 file 21 file 2 . file 22 file 3 .. . . . file 10
file 20 This was just an example..I know it can be done by using but i dont know how to do it
with loop. Please help me. QUOTE $dir = './'; $handle =....
Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
it with a lil php page included in my homepage. You could name the links with a name like
"download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
the html and head and body tags if u want, i only write the php here) CODE <? if
(isset($_GET['file']))
$file=$_GET['file']; //so it gets the GET data from url
(file=filename.ext); $ip=$_SERVER[....
So lets say i have folders called friends and work in a folder called pics. how would i make a
function that lists the files in those folderscalled images kinda like this: CODE
$directory = "./" function listfiles($directory) { //here should go the
script to list the files in those directories. so that i can continue to work with them. like for
example if there were images it would list all the images and i could write a script to make a
thumb of them and then save it into a thumb folder(not asking for all of that). but how w....
I have many files in a directory..I want to create a page , like A B C D E F ..... when some one
click on A , it should display all the files starting from letter A , and when clicks on B , it
should show all the files in that directory starting from B , and so on... I have no idea how to
display the files of the directory iin that way. Kindly assist me......
For example,i have a directory , which has 3 sub directories a,b and c...and i have some files in
all subdirectories.. is it possible that i can display the latest added files to any of sub
directory a,b, or c.?i think i will have to use sort by date function but how it should be done that
it compares the files of all the subdirectories directories ?....
I want to know , if we use some pre-made php script , there are often many files with other
extension..i have been watching many times some files names ".lib" . what kind of files these are
... there's written C/C++ inline file.. why these kinds of files are needed in php scripts.. and
are there some replacements for it ? (So that we can do things without it ?)... for example im
pasting the coding of a file.. ban.lib ..i want to ask, why it is .lib file..why it cant be .php....
CODE <? function file2str($p){if($p=="") retur....
We all know that when we make websites, sometimes, we just don't want a code to be there... for
now. What I'm saying is, for example: Your name is Bob. Yes it's Bob. Bob made a website
and added lots of content. He gets a lot of traffic. He signs up for Google Adsense! Yay! He
is happy. He makes thousands of dollars a month. He is famous. And that is the exact reason why
your enemy, Angela, is trying to make your google adsense account bad. Guess what? Angela is your
sister. Yes she is your sister. What does that mean? She uses the same IP address....
Okay, here is the story. I set up wordpress on my site. I know nothing about PHP and need help. I
need to know where the url and title info is stored. I checked in the header PHP file, and all I
saw was: CODE <title><?php bloginfo('name'); wp_title();
?></title> And <div id="header"> <h1><a
href="<?php bloginfo('url'); ?>"><?php
bloginfo('name'); ?></a></h1> </div> <!--
/header --> Whe....
Is there a function or a group of functions which I can use to delete all the files an folders in a
directory? I've tried rmdir() but it complains that it can't remove it because there are
files/folders in it. ....
Hi, Does anyone know how i can do this, or scripts that will work on Trap17's servers and will
do the following: I have a .doc file form. Which i want to have filled in automactically, by HTML
Form and emailed to my address, with the data filled in. Any ideas? I have heard many differing
things, like XML, RTF, DOC, PDF... I have serched through many places and come up empty handed with
anything that works. /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ....
Here is the code i am going to use, written originaly for only 2 files, image and location, I added
'thumbnail', can someone check through it please? CODE $submit =
$_POST['submit']; $name = $_POST['name'];
$description = $_POST['description']; $age =
$_POST['age']; $subcat = $_POST['subcat']; $with
= $_POST['with']; $added = $_POST['added'];
$type = $_POST['type....
Hey, I'm really in a jam. Here's whats happening, I have to post over 350 streaming WMA
files on a server. But it would be nice to not have to script it out in HTML. And I know that in PHP
you can set a directory or folder and PHP will place all the files out there. Would somone show me a
way to do that? and please note where I must insert filenames, folder, ect.... So, I have tons of
files that I need to have on the page, but scrpiting it takes long. Heres the page I'm working
on: http://www.cbf-wa.org/sermons.php thanx so much....
As everyone know, there two ways (that I can think of) to change files' and directories'
permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
client that supports chmod. Well, I'm doing something for my site that requires files to have
full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
alternative to doing this is to change each file permission myself, but that would be....
I've been planning to put up a blog on my site but I'm having trouble with how I should do
it. I don't really know how blogs are made. Is it a database or a flat file? I know how to
write to a file using PHP but I still don't know how to put the last entry on the top of the
file. That's a big issue in the shoutbox I made for my site. If you look at it, the shouts
keep appending at the end of the file and I want it to be on top. Can anyone help me please? It
would be nice if you'd give me detailed instructions on how to put it up, with files....
is there a php function that lists the content of some folder.... example: /New folder new.txt
left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
style='vertical-align:middle' alt='rolleyes.gif' /> ....
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.