Algorithms Arrays Passwords Uncategorized
Commerce Uncategorized
Databases Abstraction Layers Informix LDAP MS SQL MySQL ODBC PostgreSQL Uncategorized
Date & Time Calculators Conversion Translation Uncategorized
Discussion Chat Forums Guestbooks Polls Uncategorized
Email Validation Uncategorized
External Uncategorized
Files and Directories Uncategorized
Games Uncategorized
Graphics 3-D Graphs Resizing Thumbnails Uncategorized
HTML Forms Menus & Navigation Source Viewers Tables Templates Uncategorized
HTTP Authentication Cookies File Uploading Uncategorized
I18N Uncategorized
Math Uncategorized
Miscellaneous Uncategorized
Searching and Trees Uncategorized
Security Uncategorized
Text Uncategorized
Utilities Calendars Counters Link Checkers Weather Uncategorized
XML Uncategorized
| php sample source codes |
|---|
|
A framework to get the directories list at a given path and possibly print it, core or as ht-links to each directory (useful if each contains an index.htm for ex) ... to be extended
|
|
comma separated values - read and write
Features:
supports any separator char sequence, default is semicolon ";".
supports separator characters in the values. eg you use a ; as separator, your line may look like
blah;hello world;"foo";"foo;bar";"this is a ""string""";got it?;foo
as you can see, the values can be in "quotes". if your text uses quotes itself as in the "string"
example, they are escaped in ms-style with 2 quotes. and by using quotes we can even have your
separator inside the text (example "foo;bar").
line breaks. a csv line may spread over multiple lines using crlf in a field value.
see the checkMultiline param and the _checkMultiline() method.
this class is part of the blueshoes application framework.
|
|
The IniHandler can read and write ini-style files (and strings). Many options can be set.
|
|
Class to read Commodore 64 .D64 files. This will produce a listing of the contents of the disk in an array with all details (see example).
This was mainly produced as a test of PHP's file handling functions and class implementation (which I think it handles quite well!)
|
|
Creates deep directory structrure path to any depths.
|
|
function that reads directory content and returns the result as links to every file in the directory.
toss it into any directory as index.php and get a list of links to every file
|
|
This handy little function will, given a starting directory, return an array of directories contained within the original directory. It does this by using recursion, a process by which a function calls itself repeatadly, until all conditions are met.
Syntax is
Array RecurseDir (string starting_directory)
|
|
Returns disk usage in bytes of directory $d. Limit depth level with $depth.
|
|
This script will auto link any text file in table manners in selected directory, and auto link them. Great for website like Olga, lyrics and tabs
|
|
This class block any download from unauthorized site to your files. You can also share files stored in non-web folder.
|
|
This code dynamically lists the (video) files in a directory, loads them into an array, sorts them by name (without the extension), and then displays them with a thumbnail link to the actual (video) file. It also displays the size of the files in kb.
I wrote this after giving up on the other array and sort code that I'd seen. None of them seemed to do all of this at once.
Note that the .jpg thumbnails that link to the movies all have the same prefix name (the substring is identical). This allows the link to work. A simple text link would have done the same thing.
|
|
Updat the news section on your site easily without using a database.
|
|
Files and Directories Browser and Source Code Viewer... not anything special
|
|
Looks in any directory you specify and gets all the files with extensions given by you. Returns them as an array that you can do anything with, I used it to pick four photos from the photo album directory at random (sort of random) and display them in the footer of a page. Works around open_basedir restrictions.
|
|
Hi. I wrote this one for "local" purposes. It allows to navigate and pick up an unlimited amount of files and folders. It returns a 2-dim-array with the file/folderpath and an index: 1=folder, 2=file.
It requires javascript. It was tested "local" on Windows2000 and IE6, but not on an "external" server nore with other browsers.
You'll have to adapt the list of the drives manually.
|
|
The function of this script is to distinguish wether the returned array is a file or directory, if it is a file, it generates a link to download the file, otherwise if it's a dir, it creates a link to list the files/dirs in that directory, works on windows and *nix platforms.
|
|
This function allows your script to search through a directory tree for a file.
The search is depth first. The fully qualified file name is returned if the file is found.
|
|
This is a simple class that will let you search specified directories on your server, using specified file extensions, for a query string.
|
|
This is a early version of a filesystem editor we wrote for our developers kit. It allows you do view a directory, create files, erase files, edit files, create directories, remove directories, and upload files from your browser directly into the directory.
|
|
The filemanager class can be used to create a php filemanger, you can define a chrooted kind of basedir, and use the $_GET array to define a subdir. It has some built in protection against "?subdir=../" stuff and it has alot of little extras, like sort functions, MIME type checks and lots more.
I have been using it a long time now, and it never failed me :)
|
|
This generalized code snippet finds out the current file name without the extension part and can be of use in any template driven site where you have to dynamically generate names of graphics or other files to be loaded depending on the name of the page loading. Being generalised it doesnt matter how comlicated the URL is or how deep the current file is embedded. It still pulls out the name correctly.
|
|
Function for calculating and formating a file size in bytes to human readble format
|
|
I wrote this for my message board. It takes a int which is bytes, and makes a string to represent the filesize in a cleaner format, like 1.56 KB or 56 GB. It has a optional second parameter, bytesstyle, which if set to one will add (n bytes) at the end of the string returned.
If for some reason you need values bigger than TB (right now I can't imagine where) but you can simply copy one of the if ($int >1024+... code and somply replace the value of $str.
Other styles can be added easily by copying the if ($str != " bytes" AND $bytesstyle == 1){$str .= " (".$bytes." bytes)";} snipplet and change the $bytesstyle value.
The +256 are for precision. You could also add a negative value and get returns like 0.95KB. With the setting of positive, you get values such as 1154 MB.
|
|
format_filesize choses the best human readable unit for $bytes returns a formatted string
|
|
This script parses FTP wu-ftp log file
(xferlog) and show some stats sorted by username.
Total bytes, bytes by day, incoming and outcoming totals
|
|
This function wil download all files and subdirectories recursively if need be from a specified directory on a aremote server. It works just like other PHP ftp functions.
|
|
You can get file list (in array) from start directory and it subdirectories.
|
|
A global search and replace using PHP.
You'll need to specify several parameters as GET/POST parameters:
oldword=[text to replace]
newword=[new text]
rootpath=[path to dir containing files to alter]
Note also that PHP must have read/write access to the files to alter them.
|
|
Show's the last edited file in a directory
|
|
List All Entries in a Directory in Alphabetical Order. Create Directories, Upload Files, Rename Files and Directories, Delete Files and Directories, Edit Files, Set Permissions (modes) for Files and Directories.
|
|
This code allows you to dynamically list a directory's image files, creates links to them, and tells you their size in pixels and kilobytes.
|
|
This class allows you to view man pages through a browser. The man page is formatted correctly, and includes highlighting and italics where appropriate. Email addresses can automatically be rendered into clickable links.
Not only can you enter the man page to view, but you can also list all man pages available on the system, or all man pages starting with a certain alpha, numeric, or non-alphanumeric characters.
|
|
return the first line in a given file containing the given string
|
|
Read and write ID3 v1.0 and v1.1 tags of MP3 files.
This class is meant to access MP3 audio files with meta-information tags ID3v1.0 and ID3v1.1 .
The class can find the ID tags to extract the the audio track meta-information that describes items like the title, artist, album, year, track and music genre.
The class can also update MP3 files to write or remove the ID tags with the track meta-information.
|
|
Alot of people have asked for VERY simple FTP functionality with PHP, so here it is. This class was designed with very simplistic transfers in mind. You simple create the class, get/send a file and then 'kill()' the object. It's that simple. I you find it useful.
|
|
Without loading the memory pick up a random item from a text file to display a random item e.g. Quotable quotes, a URL, address of a graphics file or even a code segment etc.
|
|
This will take an assigned directory and print out its content, hyperlinking to each file and printing the results on the page with out the .php extension. works great if you have a small site and you want to use it for navagtion.
|
|
Picks a file at random from the given directory. Accepts wildcards.
|
|
I designed this specifically as a random picture generator, but im sure it can be used for many things. You make a directory with the pictures that you want to randomly select. Using this funciton, you just use the directory as the aurgument and it returns the path of a random file in that directory.
|
|
These functions are very simple, useful and powerful.
They allow you to retreive a url as a variable that can be cached, reloaded, transformed and or saved.
No need for CHMOD or file permissions issues when copying, saving, editing, or writing to files.
|
|
This mini-script lists your directory structure from a starting point. Nothing special - but small and far from complex and not used for a certain purpose. You could modify and use it for whatever you need.
|
|
A function to check if a given filename is an RPM (ends with ".rpm") and if so will return an associative array with the Name, Version, Revision, and Architecture.
|
|
This function was widely inspired by dwebb's File Search function (see: http://www.zend.com/codex.php?id=301&single=1)
It's basically the same function but now it returns an array to support multiple matches, it's also more flexible because I used stristr() instead of a literal match, wich is quite useless for a search function...
|
|
A script that performs a search and replace function. Written because I didn't have one at the time. Can perform over multiple files and/or directories. Can be configured to ignore certain lines.
|
|
Place this script in a directory of your site and it will transfer via ftp all nested dirs and files to another server (of course it may be the same server).Don't lose time downloading and then uploading.Let the server do it all.Instructions and comments to code included.
|
|
sikil ( seekandkill ) this tool originaly make for helping mweb Indonesia developer/designer/admin to find useless file on our servers, i.e DEADJOE file or .html~
using /dev/stdin, and run only in linux machine
|
|
tests to see if an image file (jpg/gif..) exists and if it does not then it can display alternative text!
Good to use if your website in underconstrucion and you are waiting for someone else to add images as they get them. No more explorer missing image icons!
|
|
Upload/Download files, navigate/create folders with password protected login (without database) and with JUST *ONE* 8Kb FILE!
|
|
This FIl eManager needs PHP Only and does making directories, uploading files, viewing, renameing, deleting, EDITING! i just cant get the glimps dir thing to work or the back to root and the view (the glimps dir/root) otherwise, its FULLY functional!
|
|
I used to use Gossamer Threads "File Manager" written in Perl, but decided to write my own in PHP.
<BR><BR>
This application lets you
edit, browse, CHMOD, view, move, rename, copy, upload and create files/directories in any forms/tables enabled browser.<BR>
(Option to create html skeleton-files.)
<BR><BR>
newest version is always available at
<A href="http://www.suneworld.com/programs">http://www.suneworld.com/programs</A>
<br>Thanks to <a href="http://zend.com/search_code_author.php?author=bleach">Bleach</a> for inspiration (file.php)<BR><BR>
(Go to <A href="http://www.suneworld.com/programs">http://www.suneworld.com/programs</A> to download needed gifs.
|
|
Class "WriteConfigFile" is a tool to manipulate simple config-files in php-script style.
It is able to create or manipulate files which later can be included directly into php-scripts.
It is able to write bool, numericals, string and (multi-dim) arrays.
Code is designed to to avoid many different file writes. It also fixes problems with some permission-systems which reset attributes after modification.
|
|
This function copy all the files and directories (including all sub directores) from target to source like XCOPY command.
|
|
This function copy all the files and directories (including all sub directores) from target to source like XCOPY command with simplest way.
|
|
Code class to create "zip" files on the fly.
|