Code Library
PHP Code
2,610 Views
Alternate table row colors with php
1,852 Views
Function to output all 256 ascii characters
2,840 Views
Logs all hits in the format: day, date, time, ip, browser and referer to a text file
1,783 Views
Simple function to check if a value exists in a database, most useful from a form.
2,072 Views
Making a connection to your mysql database using php
2,185 Views
Echo all files in a particular directory
1,791 Views
This is a simple directory search i wrote for here to search the php manual, it will search the filenames in the directory, not the files themselves
1,660 Views
Count the total number of files in a directory
2,058 Views
simple code using explode();
1,651 Views
Echo all folders in a particular directory
1,464 Views
This was a javascript function that i found ages ago, but the W3C validator didn't like it, so i re-wrote it in PHP, no idea who made the original one. It's the same as the colour table used here.
1,722 Views
Highlight PHP Syntax
2,391 Views
Display the number of hits to your website
2,150 Views
Basic format to send a HTML email
1,554 Views
to check if code contains <html> tags it will go true if it contains anything like <something>
1,618 Views
A quick example of IF and GET,
2,316 Views
Log visitors ips and time/date of visit in a simple text file
2,361 Views
Display the last 5 referers to your site on your homepage
1,424 Views
An easy way to return the number of lines in a file
1,591 Views
Basic script to check if a link (url) is valid
1,895 Views
Splitting an amount of MySQL data onto multiple pages.
361 Views
Manages the output of nested quote strings.
2,000 Views
Display "this page was generated in x.xxxx seconds" on your pages
1,547 Views
Check if a certain site or server is up by opening a simple socket
1,742 Views
Random Image script
1,400 Views
Display a link or line of text from a selection at random
1,624 Views
Function to generate a random alphanumeric password
1,312 Views
Simple function to return the extension of a file, suitable for just filenames, not webpath/filename
1,490 Views
file reversal code.. good for tagboards.
2,135 Views
Shows people thier IP
1,491 Views
An easy way to get your full server path when installing php scripts
1,798 Views
Tells you when your friends have birthday!
1,309 Views
Quick example of how to split a number into two values using substr()
1,638 Views
For people using the switch function for their pages like ?page=blah, if you have alot of pages this is a much shorter way to include them as they are called
1,661 Views
Another switch replacement example.
4,616 Views
A selection of examples for displaying time & date
1,802 Views
Function to check an email address is a valid format
1,855 Views
Deny access to a specified IP, allows you to use * wildcards, to help stop people who's ip's change each time they reconnect