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,782 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,462 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,552 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,360 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,545 Views

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

Random Image

1,741 Views

Random Image script

Random Link

1,400 Views

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

Random Password

1,622 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,488 Views

file reversal code.. good for tagboards.

See your IP

2,134 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,797 Views

Tells you when your friends have birthday!

Split Number

1,308 Views

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

Switch Function Replacement

1,637 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,660 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,854 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

JavaScript Code

Add Bookmark

1,880 Views

A simple snippet so visitors can add your site to their favorities

Alert Once Box

1,590 Views

Pop up a message alert box for your visitors, that they only see on the first visit

Block Errors

1,434 Views

This will block the "done but with errors on page" message that you sometimes get on the statusbar

Break Out Of Frames

1,414 Views

Stop your website getting trapped in a frame (forces the window ontop)

Check Radio Buttons

1,471 Views

Simple function to loop through a number of radio buttons in a form to see if one is checked

Custom Cursor

1,683 Views

Allows you to use a custom mouse cursor on your site

Email encode

1,539 Views

This javascript will encode an email however still let mailto: work with it :)

Extra Button(Proboards)

1,695 Views

This lets you add an extra button to the top menu bar, so you can add a button to link to your website homepage, chatroom or whatever

Guest Redirect(Proboards)

1,367 Views

Redirects guests on your proboards forum to the register page, this is a heavily modified version of a non-working code i found at support.proboards.com (place in your main header)

Hide Show Layers

2,123 Views

Ability to hide and show elements of a html page.

MailForm

1,973 Views

A basic html mail/contact form layout

Page Refresh

1,518 Views

Let visitors refresh your page from a button, usefull if you display some random content

Play Music

1,983 Views

Code to play an mp3 file as background music on your site

Popup Window

1,651 Views

Create a simple popup window, you can easily edit the size and other attributes

Random Page

1,215 Views

Put this code in your page, and you will goto one of 3 pages you assign

Redirect Page

1,405 Views

Automatically redirect people to a certain page when the visit another

Rules Popup(Proboards)

1,253 Views

This mod can display your rules thread in a popup window when a new user clicks the registration page

Set As Homepage

1,389 Views

Let visitors set your site as their default homepage

Shake Browser

1,494 Views

When you click an assigned button, it shakes your browser and everything on the page

Show And Hide Content

1,860 Views

Use this for collapsible menus or any content you want to show/hide from a link

Time And Date JS

4,404 Views

Display the current time & date on your website

View Page Source

1,521 Views

Pop up the source of the page from a link. (IE/Mozzila)

Window Popup

1,461 Views

When the page loads make a window popup.