Sectionalize Text
15
This function converts a CSV file to a simple XML file.
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.
16
I've seen XML 2 Array functions done in other ways but this is the shortest implementation I've seen yet. I didnt write it myself though, but I thought I'd submit it for common good of this site. It uses regex and works prefectly.
15
Basic internal class loading for PHP. Could make some plugins with this code if used properly.
17
Database Class with quick connectivity and useful database functio
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.
12
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:
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
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
A little function that does some basic checking for data input by a user. Should get rid of code injection ;-)
12
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 ;-)
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 ;-)









