All-Purpose Form Pre-Validation





ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

14
Date Submitted Mon. Oct. 9th, 2006 10:09 AM
Revision 1
Helper inxilpro
Tags debug | HTML | PHP | Variable
Comments 2 comments
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.
12
Date Submitted Mon. Oct. 9th, 2006 8:18 AM
Revision 1
Helper shell
Tags PHP
Comments 1 comments
Over the summer, I worked on a project in which I needed to parse logfiles which were in the following format:

IP|USE|TIME>IP2|USE2|TIME2>

and so on.

When I parsed them to display the log file in a user-friendly fashion, I used the following code:
-12
Date Submitted Mon. Oct. 9th, 2006 7:29 AM
Revision 1
Helper BrandonReese
Tags MD5 | Password | PHP | Random
Comments 5 comments
This is a quick and easy method to generate a somewhat random password. This simply generates the MD5 hash for the integer returned by the time() function and then truncates it to the specific length.
-17
Date Submitted Mon. Oct. 9th, 2006 7:07 AM
Revision 1
Helper serpentskiss
Tags PHP
Comments 3 comments
A little function that does some basic checking for data input by a user. Should get rid of code injection ;-)
12
Date Submitted Mon. Oct. 9th, 2006 7:04 AM
Revision 1
Helper serpentskiss
Tags PHP
Comments 2 comments
Here's a little snippet I got from SitePoint that I now use all the time. Add the code below to the start of each script.

Basically, what this does is checks to see if magic_quotes_gpc() is enabled on the server, and if it is, then it gets rid of all the slashes that magic_quotes_gpc() adds to input from $_GET, $_POST and $_COOKIES globals.

It's a good snippet to use, because it negates the bad programming practices that having magic_quotes_gpc() lets you get away with, and means that you don't really on PHP to validate your input; you get to do it all yourself ;-)
6
Date Submitted Mon. Oct. 9th, 2006 5:51 AM
Revision 1
Helper serpentskiss
Tags "Email Address" | RegExp | Validate
Comments 1 comments
PHP function to validate an email address.
12
Date Submitted Fri. Oct. 6th, 2006 9:25 AM
Revision 1
Helper BrandonReese
Tags PHP | phpcode
Comments 4 comments
This is a class for generating HTML tables. It's kind of rough, but I thought somebody might want to do something with it.
24
Date Submitted Thu. Oct. 5th, 2006 11:49 AM
Revision 1
Helper Idlemind
Tags mysql | PHP
Comments 2 comments
"Today in the news, MySQL previews..."

As a "preview" of text, this MySQL select will return the first few words out of a text field in a database. It returns entire words (doesn't cut them off in the middle) and follows the last word with an elipse "..."

In the PHP, assign $CharactersToDisplay to a number - the approximate number of characters desired (or you can hard-code it if you want).

For the example, I also use $TheID as the row identity for the record to display.
-11
Date Submitted Thu. Sep. 28th, 2006 3:43 PM
Revision 1
Helper ffxfiend
Tags "php" | PHP | phpcode | RegExp
Comments 1 comments
This is a faily simple function to validate a URL being passed into your scripts. It will allow for http, https, and ftp. The beginning www. of a URL is optional as well. It will also validate if you have an IP address in place of the domain name. I'm sure this can be improved upon as this is my first attempt at regular expressions but it has worked good for me so far. Please comment or improve if your able.

Thanks!
12
Date Submitted Sun. Sep. 24th, 2006 5:43 PM
Revision 1
Helper kahotep
Tags HTML | PHP
Comments 6 comments
Generates select boxes, text boxes, check boxes and radio buttons. Via a handful of functions.