File indexing php script

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Free Super Clean PHP File Directory Listing Script

halgatewood/file-directory-list

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Читайте также:  Установка временной зоны javascript

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Free Super Clean PHP File Directory Listing Script

Easily display files and folders in a mobile friendly, clean and cool way. Just drop the index.php in your folder and you are ready to go. Past versions of this script can be found here: https://halgatewood.com/free/file-directory-list/

At the top of the index.php file you have a few settings you can change:

This will be the title of your page and also is set to the meta mitle of the document.

Change this variable to dark when you are feeling down.

— $ignore_file_list = array( «.htaccess», «Thumbs.db», «.DS_Store», «index.php» );

Create an array of files that you do not want to appear in the listing

You can create an array of extensions not to show, for example: ‘jpg,png,gif,pdf’

This will sort the files, the available options are: name_asc, name_desc, date_asc, date_desc

A data sprite of evenly spaced out icons. You can create your own like the one found here: https://www.dropbox.com/s/lzxi5abx2gaj84q/flat.png?dl=0

If a folder is clicked on, it will slide down the sub folder. You can turn this off here.

This will add the html download attribute which forces the download in some browsers.

Ability to hide empty folders.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

php script for easy file indexing

zvevqx/indexR

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

php script for easy file indexing

juste drop indexr.php , style.css and icons/ folder in your archive folder edit indexr.php and set url for your folder / and description

go to /yoururl/foldeeyouchoosetoputscript/indexr.php

bonus you can add htaccess to open indexr.php by default

DirectoryIndex indexr.php index.html

About

php script for easy file indexing

Источник

Super fast search by file content using PHP + Windows

I was struggling for a while to create a fast solution to search through tens of thousands of files (30.000 to 60.000 files) and I tried different approaches until I found what I believe is the faster way to do it.

I will name the different techniques I used for it and I will conclude with the fast solution.

speed-windows-php-search-com

Using PHP with DirectoryIterator

By using DirectoryIterator in combination with file_get_contents and strpos.

public function searchDirectoryIterator($path, $string) 
$dir = new DirectoryIterator($path);
$files = array();

$totalFiles = 0;
$cont = 0;
foreach ($dir as $file)
if (!$file->isDot())
$content = file_get_contents($file->getPathname());
if (strpos($content, $string) !== false)
$files[$file->getMTime()] = $file->getBasename();
>
>
>

ksort($files);

return array('files' => $files, 'totalFiles' => $cont);
>

I improved this version by using AJAX and calling the function asynchronously to read groups of 1.000 files so I could saw a progress bar. I also cached the list of documents in the path returned by DirectoryIterator.

It was quite slow. It could take 5-10 minutes or even more. The 2nd time it was run it was faster. I guess because Windows (or PHP) cached somehow the files content or something similar.

Using PHP with readdir

public function method3($path, $string, $limitFrom, $limitTo) 
$files = array();

$cont = 0;

if ($handle = opendir($path))
while (false !== ($entry = readdir($handle)))
if ($entry != "." && $entry != "..")
$content = file_get_contents($path.$entry);
if (strpos($content, $string) !== false)
$files[] = $path.$entry;
>
>
$cont++;
>
closedir($handle);
>

return array('files' => $files, 'totalFiles' => $cont);
>

No diference with the DirectoryIterator option in terms of speed.

Using Windows Batch Scripting

I though it could be faster than with PHP as it deals directly with the OS instructions. I created a file which I called «search.bat» with the following content:

@echo off
pushd "%1"
findstr /m /C:%2 *
popd

I got the results from PHP by using exec:

public function batchSearch($path, $string) 
$searchScript = public_path().'/files/search.bat';

exec('cmd /c '.$searchScript.' '.$path.' "'.$string.'"', $result);

return $result;
>

It was faster the 2nd time it was run as well. Not fast enough tough. Quite similar to the PHP DirectoryIterator solution. Also, this option offered less possibilities in terms of getting more information from the files such as the modified date or filtering by date. etc.

Using Windows Search Indexer with PHP COM

This is where the magic come true.
There’s an option in Windows to enable the indexing of files. Once you do it, you will see in the control panel a new option called «Indexing Options».
There you can add the content you want windows to index. This way the search over the files contained in the indexed folders will get reduced considerably.

Depending on the content to index it can take hours. (Better to wait now than in execution time! )

To access the Windows Search Indexer with PHP, we have to use the PHP COM Class together with ADODB.
To make use of COM you should make sure your version of PHP contains the file php_com_dotnet.dll in the extensions folder and that you are including it in the php.ini file.

public function com($path, $string) 
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$recordset = new COM("ADODB.Recordset");

//setting the limit for the query
$recordset->MaxRecords = 150;

$conn->Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");

//creating the query against windows search indexer database.
//we specify the path and the string we are looking for
$recordset->Open("SELECT System.ItemName, System.DateModified FROM SYSTEMINDEX WHERE DIRECTORY='".$path."' AND CONTAINS('".$string."') ORDER BY System.DateModified DESC", $conn);

if(!$recordset->EOF)
$recordset->MoveFirst();
>
$files = array();
while(!$recordset->EOF)
$filename = $recordset->Fields->Item("System.ItemName")->value;

//obtaining the date and formatting it.
$date = $recordset->Fields->Item("System.DateModified")->Value;
$timestamp = variant_date_to_timestamp($date);

//getting the filename and the modified date
$files[]= array('filename' => $filename, 'date' => date('d-M-Y H:i:s', $timestamp));

$recordset->MoveNext();
>

return $files;
>

By using microtime I could measure the speed of the script and I got results of 0,004 — 0,019 seconds looking for a string through 50.000 files. Isn’t it amazing? 🙂

I really wanted to post it here as I couldn’t find PHP solution for this problem anywhere else. I hope this can help someone in a close future if they have to deal with Windows and PHP together as I have to.

Источник

AutoIndex PHP Script (Directory Indexer)

AutoIndex is a PHP script that makes a table that lists the files in a directory, and lets users access the files and subdirectories.
It includes searching, icons for each file type, an admin panel, uploads, access logging, file descriptions, and more.

Project Samples

AutoIndex PHP Script (Directory Indexer) Screenshot 1

Project Activity

Categories

License

Follow AutoIndex PHP Script (Directory Indexer)

You can build a beautiful website with any CMS, but what will it be like to edit and manage over time?

Concrete5 has allowed individuals involved with websites to easily manage their content and their site structure. Above all else, the goal behind concrete5 has always been to make it easy for anyone to run a website!

User Ratings

User Reviews

Quite simply a marvelous folder/file indexer. May also be used for a simple image gallery. Minimalistic enough to be embedded within existing web sites, yet possible to run as a standalone app. To use «AutoIndex PHP Script 2.2.4» with PHP 7, edit line number 122 in index.php as follows //@set_magic_quotes_runtime(0);

Easily five stars. I have been using version 2.0.1 for many years. This script performs flawlessly, and it is very easy to customize the output. It is a also very secure, and not vulnerable to XSS or other attacks.

Additional Project Details

Languages

French, Dutch, Polish, Italian, English, Bulgarian, Norwegian, Brazilian Portuguese, German, Hungarian

Intended Audience

Information Technology, Customer Service, Education, System Administrators, Developers, End Users/Desktop

User Interface

Programming Language

Database Environment

Registered

Cerberus FTP Server provides a secure and reliable file transfer solution for the demanding IT professional in any industry. Supporting SFTP and SCP, FTP/S, and HTTP/S, Cerberus is able to authenticate against Active Directory and LDAP, run as a Windows service, has native x64 support, includes.

SyncBackPro is an advanced file backup and synchronization program that can be used with hard drives, removable media (e.g. USB drives), FTP, FTPS, and SFTP servers, Zip64 archives (with 256-bit AES encryption), POP3/IMAP4/SMTP email servers, Media Transfer Protocol devices, network shares, and.

ispmanager is a website and web server management panel that helps you automate the business. It allows you to manage Apache and Nginx web servers: install, configure the config file, and monitor resources. Through ispmanager, you can install popular CMS on the web server. You no longer.

Источник

Оцените статью