You Are Here: Home »   Codelist Thursday October 16th 2008

Code Library

PHP Code

Add text to text file
2338 Views - Added By face

Easy way to add some text to text file. You can use it like guestbook ;)

Alternate Row Colors
1968 Views - Added By Matt

Alternate table row colors with php

Ascii Characters
1463 Views - Added By Anonymous

Function to output all 256 ascii characters

Basic Site Stats
2425 Views - Added By Anonymous

Logs all hits in the format: day,date,time,ip,browser,referer, to a text file

Check Database Value
1388 Views - Added By Anonymous

Simple function to check if a value exists in a database, most useful from a form.

Connect To Mysql
1698 Views - Added By Anonymous

Making a connection to your mysql database using php

Directory List
1841 Views - Added By Anonymous

Echo all files in a particular directory

Directory Search
1460 Views - Added By Anonymous

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

Directory Total
1321 Views - Added By Anonymous

Count the total number of files in a directory

Explode
1703 Views - Added By zDos

simple code using explode();

Folder List
1276 Views - Added By Anonymous

Echo all folders in a particular directory

Hex Colour Table
1128 Views - Added By Anonymous

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.

Highlight Syntax
1394 Views - Added By Peter007

Highlight PHP Syntax

Hit Counter
1962 Views - Added By Anonymous

Display the number of hits to your website

Html Email
1789 Views - Added By Anonymous

Basic format to send a HTML email

Html ereg
1166 Views - Added By Pepper

to check if code contains <html> tags it will go true if it contains anything like <something>

If thingy
1290 Views - Added By Pepper

Learning if an Get properly take a look here :)

IP Logger
1972 Views - Added By Anonymous

Log visitors ips and time/date of visit in a simple text file

Last 5 Referers
2056 Views - Added By Anonymous

Display the last 5 referers to your site on your homepage

Lines In A File
1072 Views - Added By Anonymous

An easy way to return the number of lines in a file

Link Validator
1273 Views - Added By Anonymous

Basic script to check if a link (url) is valid

Multiple Page Lists
1529 Views - Added By Anonymous

Splitting an amount of MySQL data onto multiple pages.

Page Generation Time
1622 Views - Added By Anonymous

Display "this page was generated in x.xxxx seconds" on your pages

Quick Site Check
1223 Views - Added By Anonymous

Check if a certain site or server is up by opening a simple socket

Random Image
1428 Views - Added By Pepper

Random Image script

Random Link
1084 Views - Added By Anonymous

Display a link or line of text from a selection at random

Random Password
1283 Views - Added By Anonymous

Function to generate a random alphanumeric password

Return File Extension
941 Views - Added By Matt

Simple function to return the extension of a file, suitable for just filenames, not webpath/filename

Reverse Code
1155 Views - Added By zDos

file reversal code.. good for tagboards.

See your IP
1783 Views - Added By Tyler's Network

Shows people thier IP

Server Path
1154 Views - Added By Anonymous

An easy way to get your full server path when installing php scripts

Simple Birthday code
1463 Views - Added By Z!plink

Tells you when your friends have birthday!

Split Number
989 Views - Added By Anonymous

Quick example of how to split a number into two values using substr()

Switch Function Replacement
1301 Views - Added By Anonymous

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

Switch Replacement2
1291 Views - Added By Pepper

Switch replacement diffrent from other

Time And Date
4187 Views - Added By Anonymous

A selection of examples for displaying time & date

Validate Email
1443 Views - Added By Anonymous

Function to check an email address is a valid format

Wildcard IP Deny
1523 Views - Added By Anonymous

Deny access to a specified IP, allows you to use * wildcards, to help stop people who's ip's change each time they reconnect