Simple Error Class
15
Generates a tree view within a dropdown select box.
12
Generates select boxes, text boxes, check boxes and radio buttons. Via a handful of functions.
-8
This class is a simple authentication scheme which makes it easy to add authentication to any page by including one class and adding one table to your MySQL database.
The following functions are employed by this authentication class:
auth()
is_authorized()
mysql_bind()
user_create($username,$email,$password)
user_activation_message($username)
user_activation($activation_hash)
user_password_change($username,$password_old,$password_new)
user_logout()
is_username_available( $username )
The following functions are employed by this authentication class:
auth()
this is the default constructor; it automatically checks for the POST vars "username" and "password", it also checks to see if the user passed the GET variable "logout", which would prompt it to set the authentication status to un-authenticated.
is_authorized()
Checks the SESSION variable "authorized" and returns true or false depending on that variable.
mysql_bind()
This is automatically called by the constructor each time the class is instantiated and $_POST['username'] and $_POST['password'] are present. It queries the db for a valid username and MD5 encoded password.
user_create($username,$email,$password)
Creates a user, if the username is available, and creates an MD5 hash based on username, password and date, to be used in the "activation" of the account.
user_activation_message($username)
Sends the custom activation message to the email address for the username specified
user_activation($activation_hash)
Checks to see if the activation hash is valid, if it is, the activation_hash variable is set to NULL, thus signifying that the account is active.
user_password_change($username,$password_old,$password_new)
Quick and easy way to change the user's password with one function call.
user_logout()
Sets the authorization status in $_SESSION['authorized'] to FALSE
is_username_available( $username )
Returns TRUE or FALSE depending on whether or not the username is free.
28
Create a Thumbnail
13
daysBeteenDates will calculate the number of days between 2 dates in the form of 'YYYY-MM-DD'.
5
The resize_image function allows you to resize a GIF, JPEG or PNG file to any dimension you wish and put an optional black border around the image. Here's an explanation of the arguements:
$image_path: The complete path to the image to be resized
$max_width: Maximum width of the resized image. Leave 0 if you want to specify only the height and have the width auto-scale.
$max_height: Maximum height of the resized image. Leave 0 if you want to specify only the width and have the height auto-scale.
$file_prefix: This will prepend a string onto the resized image filename. If you want to create a thumbnail image and keep the original, set $file_prefix = 'thumb'.
$dir: Allows you to save the resized image to a sub directory under the $image_path directory. If you want to save thumbnail images to images/thumbs, set $dir = 'thumbs'.
$border: boolean, 1 = border, 0 = no border
$mime: Image mime type. (image/jpeg, image/gif, image/png)
$image_path: The complete path to the image to be resized
$max_width: Maximum width of the resized image. Leave 0 if you want to specify only the height and have the width auto-scale.
$max_height: Maximum height of the resized image. Leave 0 if you want to specify only the width and have the height auto-scale.
$file_prefix: This will prepend a string onto the resized image filename. If you want to create a thumbnail image and keep the original, set $file_prefix = 'thumb'.
$dir: Allows you to save the resized image to a sub directory under the $image_path directory. If you want to save thumbnail images to images/thumbs, set $dir = 'thumbs'.
$border: boolean, 1 = border, 0 = no border
$mime: Image mime type. (image/jpeg, image/gif, image/png)
10
Give this little function a start date and number of days and it will calculate the end date.
14
Here's a basic function for debugging any kind of PHP variable. It allows for "invisible" or "visible" output--that is output in HTML comments or within visible HTML tags. It also supports customizable "containers" which lets you easily edit the look of the visible and invisible blocks. Examples in code below.
15
This is a bare-bones DB connectivity class. It's really just meant to abstract a few basic mysql_ functions so that if you ever have to change DBs you don't have to change every database function call.
I really just threw this together on a whim with no testing what-so-ever. Also, it only abstracts the most basic MySQL functions--this is intentional; please expand it as you see fit.
I really just threw this together on a whim with no testing what-so-ever. Also, it only abstracts the most basic MySQL functions--this is intentional; please expand it as you see fit.
15
This function converts a CSV file to a simple XML file.









