Directory Listings
I am using the following code to list the files in a directory.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Sorting Directory Listings With Php - Doable?
Curious to see what I can do with php in terms of getting a directory listing and sorting by name, size, and date modified. I looked at a few functions on php.net, but nothing struck me as what I needed. Note, there are several hundred files in the target directory... loading filenames, sizes, ect into arrays may not be a good solution here.
View Replies !
View Related
Sort Of Fancy Directory Listings
It will at the top contain some info that they put in, like a general description and a few other fields (I can customize the PHP code to do whatever particular fields, I'd just prefer to find something with this general capability already in), and below have a list of files in the directory and their sizes listed in a sane manner (i.e. "3.4 MB" not "3565158 bytes"). Ways this could be done I was thinking could be a text file in the directory that the PHP looks for (and preferably omits from its directory listing, but that's no big deal), or with a database. I'm also hoping whatever I find can be fit in to the client's site design to keep with their site theme, though if I find a great one where this isn't very feasable I could just modify its color scheme. I did some searching and found two that are decent-looking directory listing scripts, but would take a lot of modifying. They are snif and phpAutoindex.
View Replies !
View Related
Database - Duplicate Listings
I have been working on this problem for a few days. When I write data into a sql database, the results are duplicate listings: PHP Code: <?php session_start(); $dbh=mysql_connect ("localhost", "username", "password") or die ('Cannot connect to the database: ' . mysql_error()); mysql_select_db ("database name") or die ("Cannot locate database: ".mysql_error()); mysql_query("INSERT INTO tablename (website) Values('website_es')"); echo "Data Transfer Complete"; ?> After emptying the table and running the PHP script: The results in the database: id website 130 website_es 131 website_es As you can see, I have been working on this for some time, id=131.
View Replies !
View Related
Retrieving Listings From FTP As Printouts
I need to retreive a list of directories and then a list of all files inside those directories via FTP. <? $ftp_server = "ftp.foobar.com"; $ftp_user = "foo"; $ftp_pwd = "bar"; $conn_id = ftp_connect($ftp_server); ftp_login($conn_id, $ftp_user, $ftp_pwd); $contents=ftp_rawlist($conn_id, '.'); print_r($contents); ftp_close($conn_id); ?> What this gives me is a list of all files and directories from where i logged in as an array. What I want to do is just limit it to the directories from where I logged in, and then retrieve the listings inside of the directory. [0] => total 576 [1] => drwxr-xr-x 2 root root 4096 Oct 12 04:24 1110 [2] => -rw-r--r-- 1 root root 0 Oct 12 04:24 file2.xml.gz [3] => drwxr-xr-x 2 root root 4096 Oct 12 04:28 1154 [4] => -rw-r--r-- 1 root root 0 Oct 12 04:28 file.xml.gz SO for me to get just the directories (which are only numbered) I have to attack the array with a bunch of commands to strip out any of the gz files. Then I have to cd into each directory in the array and create a listing there. Is there not an easier way of doing this?
View Replies !
View Related
PHP Nightmare.....Integration Into EbaY Listings
I've been searching all day for a method on how to integrate the listings off ebaY onto my website, but I have had no joy whatsoever. I want to be able to open a listing based on the the item number, which I can do simply by using, $ITEMNUMER = ("blah"); http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$ITEMNUMER but, I cannot use include(); to achieve what I want to do, because a) it is having trouble including external webpages b) the ebaY listing is generated upon arrival, so theres no way it could interperate it. I've been trying all kinds of fopen(); techniques, but nothing seems to be able to open the page, because (I assume) it doesn't exist till an actual browser visits it, and it calls it values from the ebaY database. So, I tied using the ebaY API, but I'll need to pay a hellish amount to use it, so it seems out the question. What I really want to do is have a script check a listing for some text. But, as I cannot get PHP to open the file, I'm stuck ! If anyone knows a way how I can strip some information out of an external web page using PHP -
View Replies !
View Related
Joins Tables Togeather To Get Thread Listings.
Ive written this join query, that joins tables togeather to get thread listings. PHP Code: $sql = mysql_query("SELECT a.thread_id, a.starter_id, a.topic, a.time_created, a.time_replied, a.reply_id, a.sticky, a.locked, a.views, a.replys, b.active_id, c.username, c.class, c.age, c.gender, c.location, c.login_time FROM c_threads a LEFT JOIN c_active b ON a.starter_id = b.user_id LEFT JOIN c_users c ON a.starter_id = c.user_id WHERE a.forum_id = " . quote_smart($cat_id) . " ORDER BY a.announcement DESC, a.sticky DESC, a.time_created DESC"
View Replies !
View Related
Eliminating Passed URL Variables For Multiple Listings On A Page
I have a page with a list of several users, each hyperlinked to another page of 'more info' about that user. The hyperlink contains the UserNumber, UserRegion, and UserStatus, and the receiving page picks up the data in the passed URL. This works well, but I'd like to eliminate the passing of these variables in the URL. One way is to make a graphic ('More Info') that can be clicked to submit a form. Each 'More info' graphic from the dynamically created page could hold the UserNumber, but how can I pass several variables with a single click? On some pages, there can be 100+ users, and I hate to have 100+ separate forms and hidden fields. I thought of using session variables, how can I know which user was clicked to set the session variables?
View Replies !
View Related
"Paging" (First/Previous/Next/Last To Limit # Of Listings Per Page)
I'm trying to get a handle on the best way to handle setting up my listings so that I display groups of about 25 records per page. I currently have a page that returns over 1,000 names/addresses, which is obviously not very efficient. Does anyone have any suggestions on the best way to approach this, or recommendations on what pitfalls to avoid? I'm assuming that I need to be able to count the total number of records that match the search criteria, possibly at the top of the page before any HTML output, then find some way to identify/track the first record, next record, etc...? I know I should replace my existing query with something that limits it to about 25 records at a time, right? <?php include('dbconnect.php'); echo "<TABLE width="100%" align="center" border="0" cellpadding="0" cellspacing="0">"; $query="SELECT * from artists WHERE mentor=Ɔ' ORDER BY country DESC, state ASC, city ASC, lastname ASC"; $result=mysql_query($query) or die(mysql_error("Could not execute query.")); while($row = mysql_fetch_array($result)) { $artistID = $row['artistID']; $firstname = (ucwords(strtolower($row['firstname']))); $lastname = (ucwords(strtolower($row['lastname']))); $mentor= $row['mentor']; $city= (ucwords(strtolower($row['city']))); $state= (strtoupper($row['state'])); $country= (strtoupper($row['country'])); //....etc.... echo " <TD align="left" valign="top" width="50%"><FONT size="2" face="Arial, Helvetica, sans-serif"> <A HREF="javascript:;" onClick="openProfile('artist.php?artistID=".$artistID. "','Artist','resizable=yes,width=750,height=400')">".$firstname." ".$lastname."</A></FONT></TD> //....etc....
View Replies !
View Related
Make A Directory In A Directory
I am trying to make a directory in a directory that im not currently in. I am currently in the directory /soccersim but i want to write the directory /soccersim/created/$teamname$teampass **Note** the directory /created already exists what am i doing wrong? what is wrong with my code? Code:
View Replies !
View Related
Active Directory / Exchange / Active Directory.
I'm creating an Intranet module for a client (Forum, files upload...etc...etc). This client already has a huge server running on WIN2000 + IIS 4 + Exchange + Microsoft Active directory + proxy and finally PHP 4.03 + MySql. Problem #1 : All passwords are changed every weeks, so I want to be able to import users/pass from Microsoft exchange .... Does anyone have an idea to do such thing with PHP ? Problem #2: I would like that the user logged from the firm's network do not have to log. again when connecting the module. So, is it possible to do such thing ?
View Replies !
View Related
PHP As Directory
How would I go about using a PHP file like a directory, for example, "http://mysite.com/index.php/virtual_page23"? I would like to use that form instead of "http://mysite.com/index.php?p=virtual_page23". Also, is this possible in IIS?
View Replies !
View Related
About Directory
How to check correctly if the directory already exist in the webroot? I've tried with this syntax: .... bool $state = mkdir( "test" ); if ( $state == false ) chdir( "test" ); ....
View Replies !
View Related
This Directory
Is there a way to read all of the files in the same directory without writing out the directory path? I want to put the same index file into a bunch of different folders and I want a way to say "This Folder" instead of changing the file each time.
View Replies !
View Related
Regarding OS Directory
What I'd like to do.. is hide the table "Links" if there's none there to be shown instead of having "There are no links here" I myself don't know how to do this but what i have noticed is if you don't have any categories it doesn't show up the table... just wanting the same thing to happen with the links table... I'm using OpenLD btw Code:
View Replies !
View Related
Sub Directory Name
what's wrong with this code PHP Code: <? // reading current working directory $a = opendir(getcwd()); while ($b = readdir($a)) { if ( (is_dir($b)) and ($b != ".") and ($b != "..") ){ $path = getcwd()."/".$b; echo "<a href=$path/><font color=red>$b</font></a><br>"; // reading sub directory $a2 = opendir($path); while ($b2 = readdir($a2)) { if ( (is_dir($b2)) and ($b2 != ........
View Replies !
View Related
Web Directory
how to find the address to a folder in the web root directory? As i went to write to a folder within the web root. Website is hosted on a windows server.
View Replies !
View Related
Sub-directory Php
I'm trying to include a file from the root directory to a file in a sub-directory Structure root directory www contains header.php which contains images in same folder sub directory www est contains test.php which includes header.php Code: <?php include("../header.php"); ?> The include works , but the images don't show up. The image paths on the page show up as being in the www est folder when infact the header.php has then in the same root folder.
View Replies !
View Related
Get Name Of Directory
Ok say i have a directory structure, such as mysite folder1 folder2 index.php index.php and i was at the index.php file. How would I get the name of the directory 'folder1' or 'folder2' whichever folder my index file is in?
View Replies !
View Related
Php Directory
I am in the process of making a site but cannot figure out how to make a file list from a directory, with pages? There is no database of these files. Any thoughts? Or at least a show ten random files?
View Replies !
View Related
A-Z Directory Example
I lurked around the forums but did not see an answer to this question. I need to create a company directory with A-Z links across the top with anchors for each letter so that when a letter is clicked the list scrolls to that letter. Like So: ABCDEFGHIJKLMNOPQRSTUVWXYZ A (anchor) A Company 1 A Company 2 A Company 3 --------- B (anchor) B Company 1 B Company 2 B Company 3 And so on. I found a great example of how to build the A-Z now how do I efficiently set up a loop to crank out the directory?
View Replies !
View Related
Under CGI Directory
I was told by my hosting company that all the PHP files I wasnted to upload must be put under the CGI directory. I've done that and all I get when trying to access those php files is the following message: 500 Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Error: HTTPd: malformed header from script I think this is because the server treats the files as cgi. Is there a directive I must include on my PHPs so the server may know what kind of files they are?
View Replies !
View Related
Another Sub-Directory
I want to be able to use a include from one sub-directory; to add to a page in another sub-directory, but I am having problem getting it to display. I tried to do like the manual said, but for some reason; it does not seem to be working (it does not display anything at all). <?php // this would be number.php page from sub-directory1 $mynumber="000-000-0000"; ?> <?php // this would be the page in sub-directory2 include 'http://www.domain.com/sub-directory1/number.php'; echo "$mynumber"; ?>
View Replies !
View Related
From Directory
Here is a code that will read all the files in the directory and output them as links to them but on the page it add's in 2 extra links before outputting the list: <a href="/schedule/.">.</a><br><a href="/schedule/..">..</a><br> Here is the PHP: $dir = "./schedule/"; if(is_dir($dir) && is_readable($dir)) { $dh = opendir($dir); while(($file = readdir($dh)) !== false) { echo "<a href="/schedule/".$file."">".$file."</a><br>"; } } else { echo 'Invalid directory' }
View Replies !
View Related
Directory
how to write the directory to retrive images in floder 'Images' to image_page.php the image_page is in directory /var/www/html/webportal/modules/Brochure/pages the images (image1.jpg, image2.jpg...) are in directory /var/www/html/webportal/modules/Brochure/images/Machine/APM.
View Replies !
View Related
Getting Directory Of Url
I have been trying for ages to write a php function that will be able to be given a url as a string and then return the directory of the file in the url, so basically the whole url except the file a the end. But I can't figure out how to do it. I tried exploding the url at the slashes then putting it all back together except the last part of the array, because that would generally just be the file.
View Replies !
View Related
Uploading A Directory
It's very easy to upload a file using the post method with php. The user selects the file that he will upload and submits the form... What I want to do is uploading all the contents of a directory. The user will select a directory and all the files in that directory will be sent to the server. Is it possible to do this with php ? If so how ?
View Replies !
View Related
Best Way Of Showing Directory
Im tring to create a script that will show directorys and files.. but.. i cant get it ti show another directory.. for example right now the main directory is lets say.. bo and its showing another directory that is named images.. how can i get my file. that is in the boo directory to view the images directory...
View Replies !
View Related
Use File_exists On One Directory Only??
I am developing a system in php which enables users to upload files. Users can then select a directory and the files in that directory are then outputted in a table. However, I do not want users to be able to upload a file to a directory if a file of the same name already exists within that directory. I thought I could use file_exists but as I want to restrict the search to one folder at a time, as opposed to the whole file system, I dont think this will work. Another option was to run a loop on each file name in the directory and compare it to the name of the file being uploaded. This wont work either however as php considers test.doc and Test.doc to be different where as a file server considers them to be the same. Therefore if a file called test.doc already exists and a user tries to upload a file called Test.doc they will not be considered the same and the upload would be allowed by php. This would then overwrite the original file (test.doc) with Test.doc.
View Replies !
View Related
Directory Deleted
So far i m using following code for deleting folders and files.But it will only delete those folders which r empty.I want to delete those folders also which has some files.pls give me the solution <?php error_reporting(0); include("../connection.php"); $date = date("m/d/Y"); //For finding current current function dateDiff($dformat, $endDate, $beginDate) { $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]); $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]); return $end_date - $start_date; } ?> ....................
View Replies !
View Related
PHP Scripts To Run In Another Directory With IIS
I would like to have PHP for windows run in another directory than c:inetpubwwwroot. I have tride changeing parameters in php.ini in my c:php directory. But nothing changes. When I run the phpinfo() I always get Configuration File (php.ini) Path as c:windows. But I do not have the php.ini file there. Is there something I am doing wrong or is it a bug....
View Replies !
View Related
Can't Get PHP To Run On ISS Virtual Directory.
I can't get PHP to run on ISS virtual directory. PHP runs fine if run from the www root, but if I create a virtual directory to another local drive and put the PHP files in there I cannot run them. If I put a normal html file in the virtual directory that works fine. I have checked the app mappings and PHP is in there and mapped, any ideas?
View Replies !
View Related
Enquiry On /tmp Directory
Warning : "The sessions directory does not exist: /tmp. Sessions will not work until this directory is created." I am getting this warning in my php based website, despite creating /tmp folder in the root dir where php is installed.
View Replies !
View Related
Checksum Of A Directory
I am trying to write a function wherein any change in the files in any folder on my webserver would shoot me an email alert. I thought that one easy way of doing it would be via monitoring files/folders for their checksum at periodic intervals but I have no clue how to calculate checksum for a file or folder via php. Can anyone point me in the right direction. I tried searching on google, but I guess I might be using the wrong keywords..
View Replies !
View Related
Hidden Php Directory
I've recently had what looks like an attack on a web server. The machine is running iis 6 on windows 2003 server. with php 5.0.3 and mySQL 4.1.8 installed and running. The attack has deleted my phpMyAdmin folder plus files and has hiddene the C:php directory. The folder isn't visible in Windows Explorer, but it can be viewed with the command line using the Run application. It also appears the folder with php in their name are also not visible. If anyone has any idea whatmight be causing this phenomena, please send whatever knowledge you have.
View Replies !
View Related
Image Directory
I'm having problems with the directory structure of my website, the website is in php and each page has several includes. the problem is the includes keep changing their directory paths to images. so how do I link to images so that it is universally accepted througout the site, without using the http://www.mywebsite.com/images/.... way as this way takes longer for the webserver to process.
View Replies !
View Related
PHP And Active Directory
Via a PHP script (running on a LAMP configuration - PHP with LDAP support), I run queries on the LDAP server of our office (users and arguments). Now, I want to put the result of this query (user information) in a Windows 2003 AD. I use PHP-ldap functions to connect with the domain controller: making connection is no problem, but binding (authenticated, I even tried Domain Administrator credentials) doesn't work... Does anyone has experience with this matter (PHP and AD connection/communucation)?
View Replies !
View Related
IIS+PHP: The Directory Name Is Invalid.
I have recently migrated from win98+PWS to winXP+IIS, and after that an problem has occured. When I open some of my PHP pages, I get this instead of the page I shlud get: <html><head><title>Error</title></head><body>The directory name is invalid. </body></html> Now, the interesting part is the fact that this doesn't happen every time I try to open a specific page (it happens in 80% of cases, but sometimes it (the page) just opens like nothing's wrong) and that it happens on all of my PHP pages! I presume I have misconfigured IIS... but I don't know where to start searching for a problem... does IIS have logging? Does PHP have logging? Or, has anybody encountered similar problem? I use: IIS 5.1 PHP Version 4.3.0 IE 6.0
View Replies !
View Related
Finding Directory
would like to know if there is a way to locate a specific directory on your site. I have a script which scans a directory, but it is not always running in the same directory, so the relative path to the scanned directory will be changed. Is there a way to find the location of the directory to be scanned, and build a relative url to it?
View Replies !
View Related
|