You Are Here: Home »   Codelist

Code Library

PHP Code

Alternate Row Colors

2,610 Views

Alternate table row colors with php

Ascii Characters

1,852 Views

Function to output all 256 ascii characters

Basic Site Stats

2,840 Views

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

Check Database Value

1,783 Views

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

Connect To Mysql

2,072 Views

Making a connection to your mysql database using php

Directory List

2,185 Views

Echo all files in a particular directory

Directory Search

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

Directory Total

1,660 Views

Count the total number of files in a directory

Explode

2,058 Views

simple code using explode();

Folder List

1,651 Views

Echo all folders in a particular directory

Hex Colour Table

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.

Highlight Syntax

1,722 Views

Highlight PHP Syntax

Hit Counter

2,391 Views

Display the number of hits to your website

Html Email

2,150 Views

Basic format to send a HTML email

Html ereg

1,554 Views

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

IF and GET

1,618 Views

A quick example of IF and GET,

IP Logger

2,316 Views

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

Last 5 Referers

2,361 Views

Display the last 5 referers to your site on your homepage

Lines In A File

1,424 Views

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

Link Validator

1,591 Views

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

Multiple Page Lists

1,895 Views

Splitting an amount of MySQL data onto multiple pages.

Nested Tags

361 Views

Manages the output of nested quote strings.

Page Generation Time

2,000 Views

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

Quick Site Check

1,547 Views

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

Random Image

1,742 Views

Random Image script

Random Link

1,400 Views

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

Random Password

1,624 Views

Function to generate a random alphanumeric password

Return File Extension

1,312 Views

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

Reverse Code

1,490 Views

file reversal code.. good for tagboards.

See your IP

2,135 Views

Shows people thier IP

Server Path

1,491 Views

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

Simple Birthday code

1,798 Views

Tells you when your friends have birthday!

Split Number

1,309 Views

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

Switch Function Replacement

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

Switch Function Replacement 2

1,661 Views

Another switch replacement example.

Time And Date

4,616 Views

A selection of examples for displaying time & date

Validate Email

1,802 Views

Function to check an email address is a valid format

Wildcard IP Deny

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