Tiny PHP Uploader
-2
Checks to see if a file or folder exists
The fFile variable determines whether you're
looking for a File (True) or Folder(False)
The strName variable holds the fully qualified
path you're looking For
0
Celebhir
Takes a given directory and lists all the files and folders under it, including sub folders. Resulting array contains associative (folders) and indexed (files) elements. Doesn't return "." and ".."
0
Celebhir
This function takes a directory, and a "folder" search parameter.
If it finds the directory (either in single level, or any sub folder) it will return the relative path of that folder. "FALSE" if not found. Skips over files and "." and ".." directories. Recursive by default.
If it finds the directory (either in single level, or any sub folder) it will return the relative path of that folder. "FALSE" if not found. Skips over files and "." and ".." directories. Recursive by default.
0
This function tries to locate a file in a give folder (either single level, or in any sub folder). Returns the relative file and path, or FALSE if not found. Skips over "." and "..".
1
Best use of ob_, custom error handling, and variable variales evar: simple templating.
_parse($filename[,$locals])
includes $filename and renders its output to the return value. $locals, if used, will add a set of variables to the included context.
Parse($template[,$locals])
Same as above, but allows you to define a base template folder and omit the .php - just for cleaner code.
t($template[,$obj])
...
t()
Same as Parse, but any output between the opening call and the closing call (no arguments) will be buffered intot he $content variable of the template.
Play around with t(..) to find out more; I don't feel like documenting it.
_parse($filename[,$locals])
includes $filename and renders its output to the return value. $locals, if used, will add a set of variables to the included context.
Parse($template[,$locals])
Same as above, but allows you to define a base template folder and omit the .php - just for cleaner code.
t($template[,$obj])
...
t()
Same as Parse, but any output between the opening call and the closing call (no arguments) will be buffered intot he $content variable of the template.
Play around with t(..) to find out more; I don't feel like documenting it.
1
This little function does great for passwords, usernames, files, and anything else you need a random string for.
1
This php script provides a unique random key with 32 characters and can be used to avoid the system to pass some primary keys across the url, by example.
2
A simple function (with support) that can provide the backbone to any templating system.
2
My previous entry on an easy to use SQLite interface for XUL/JS got me thinking: how many times have I had to write functions that were just wrappers for a little SQL?
Below is the fruits of that little query (excuse the pun). Forgive the dbXXX functions; my implementation depended on a small portion of a larger mysql library that I've grown accustomed to coding with.
Below is the fruits of that little query (excuse the pun). Forgive the dbXXX functions; my implementation depended on a small portion of a larger mysql library that I've grown accustomed to coding with.
2
The following script is a single interface for pre-validating any HTML form. It lets you validate your form data the way you want, while handling the rudimentary tasks itself.
1) Change just one variable to make it work with $_GET or $_POST or $_REQUEST.
2) Name which elements are 'required' all at once in a hidden HTML text input.
3) Easily provide field descriptions in hidden HTML text inputs that you can use to print error statements.
4) Call a single function to print out error statements that you can easily style with CSS.
5) It automatically checks if fields marked 'required' have been filled out.
Most of the pre-validation code is from PHP 5: Unleashed by Sams Publishing. I found it extremely useful for a recent project. Sharing it here, I removed some unnecessary functions, and tried to simplify some points.
All the comments are my own; hopefully I provided more than enough explanation.
1) Change just one variable to make it work with $_GET or $_POST or $_REQUEST.
2) Name which elements are 'required' all at once in a hidden HTML text input.
3) Easily provide field descriptions in hidden HTML text inputs that you can use to print error statements.
4) Call a single function to print out error statements that you can easily style with CSS.
5) It automatically checks if fields marked 'required' have been filled out.
Most of the pre-validation code is from PHP 5: Unleashed by Sams Publishing. I found it extremely useful for a recent project. Sharing it here, I removed some unnecessary functions, and tried to simplify some points.
All the comments are my own; hopefully I provided more than enough explanation.









