Saturday, May 21, 2011

Php Code: Higher - Lower Script

Higher - Lower Script

Php Code: Encoding converter

Usage function of encoding converter on text to any format.
Often its using to convert text from windows-1251 to utf-8

Php Code: Average

just a simple function that will get the average of numbers that you picked...

Useage: $numbers = "1 4 9 10 4 8"; average($numbers);

and will return the average of them numbers ;)

Php Code: PHP to IRC Bot

This is just a simple PHP to IRC socket bot. I've got MySQL installed on mine, and it's pretty simple to do. This is just an extremely basic example, though.

Php Code: Shout box

You can create Shout box for your site . its cool :)

Php Code: Proxy filter

You can create proxy filter for your site. To pass the blocked websites. or if you do not want to show your IP.

Php Code: Calendar

You can create simple PHP Calendar that display the current month and the week and days.

Php Code: Dynamic Dropdown Menu

A function to build a basic dynamic dropdown menu, a combo box for php. You can edit the texts and the options for the visitor.

Php Code: Online user

You can see how many onlines are in your website. Basically shows a number that is the online people on your website.

Php Code: Tagcloud Font Distributor

This will assign font sizes to tags based on their counts. It tries to evenly distribute the font sizes among the tags while keeping all tags with the same counts under the same font size. The data needs to be in the following format:

$tag[tag_name] => Tag Name
$tag[tag_count] => Number of instances of this tag
$tag[tag_class] => Resulting class name, ex: tag1, tag2

Please note that this does not work with a class object. This was designed to work with an array only.

Once you create an array of these objects, you can feed them to the cloud_tags() function which will assign each $tag with a tag_class based on it's tag_count and the overall number of font sizes and tags. The return result is the array sorted aphabetically with each tag_class properly assigned.

Php Code: Date Addition and Subtraction

You can combine strtotime with the date function to create your own date verbally. This is just an alternative to using mktime that's a little more intuitive.

Php Code: Recursive Directory Browser

This function takes in a directory path and recursively searches through the directory structure and returns all files in those directories. The file list is returned in an array.


This function has 1 required parameter and 2 optional parameters.


directoryToArray(Path to Directory [,file extention [,Display Full Path]]


If the file extension parameter is set, only files matching that extension will be displayed, ie, "jpg"


If the Display Full Path parameter is true, then the full path of the file will be returned. If it is false, only the file name will be returned. By default, this parameter is set to true.

Php Code: Mysql Table Creator

Easier way to make mysql tables. very easy example of how to make SQL databases.

Php Code: Error handler

this is my error handler (well, the standard one). It's multi-purpose, easy to understand, and to change from occurance to occurance only requires changes in three or so variables.

Php Code: Format HTML for a Textarea

we found ( phpfreecode team )this to be useful in displaying HTML code in a textarea. Certain tags like the closing textarea tag will cause problems.

Php Code: Feedback contact email form

This is a ready to go PHP script that can be pasted into a blank .php document. Run it through your webserver after changing $myemail to the value of your E-Mail address. It also sends the referring URL to help you know where the visitor was before he clicked to contact you.

Php Code: YYYY-MM-DD Date Conversion Version

This will convert a sortable YYYY-MM-DD date into a more presentable date.

Php Code: Print Variable Contents

I use this every day. It's one of the most useful PHP debugging tools. You can print all of the contents of a variable (class, array or scalar) to get an idea of how the structure looks.

Php Code: Logger

This script will log every person who comes on to your website, if you put this on every page with a new file for each page then you could tell what every person did on your site unless they download something.

Edit the code according to your need.

Right now the file is admin.txt, so you will have to create that file too.

Php Code: Page load speed

When you go to google and it says, it took 0.00023 seconds to find 2325543 items, and you think to yourself, ey I wish I could see how long it takes to load my page, well now you can! this is another straight forward little code.

Php Code: RSS Feed

This small snippet will create an RSS feed. I've tested the format using several popular RSS readers and it seems to work fine.

Php Code: Background

This changes the colour of the background depending on the day of the week! Just place this after the (/head tag) and before the (body) tag (which you will have to take out)

With this code you can make your page more attractive, by having random colors.

Php Code: Background Changer

This code changes the background of the page. You should try it and see how it works. Changing back ground of the page.

Php Code: Random Link

This will show a random link when someone comes to your page. Edit the websites that you want the user possibly go.

Php Code: Read a line from a file

simple it reads a line from path read/new.txt

Php Code: Loading Time

With this script, you simply paste it into which ever *.php file you wish to show it on, and it will show you how long it took to load that specified page and will write it where ever on the page you want.

Php Code: Random Text

This snipplet is great if you want to display random text great if you want to display a new tip each time page is refreshed or visited.

Php Code: Visitor Counter

With this snippet all you have to do is the following:
- Create a file called "count.dat"
- Upload the file to your webserver
- CHMOD it to *777*
- Insert the PHP code below

easy :) enjoy it ! :)

Php Code: Browser detecter

Very simple code that Displays the HTTP_USER_AGENT of the client. and shows what version and the name of the browser that the user is working on.

Php Code: Guest Book

This is the better guest book.
2 files,
1) process.php
2)index.php

Php Code: Displays real ip address

Displays the users real IP address, even if they are behind a web proxy.

Php Code: Login system

This is a login System, it has 3 files
login.php
register.php
lastmember.php

once a user has been logged in it will return him/her to the home page. to see if they are logged in use the code at the bottom of my script

When a user registers, it will update the lastmember.php page, so you can include it in your home page by using and it shows the last member that signed up. you can add/change the stuff in the last member.php page but i suggest not changing anything, because i hate people saying they changed so and so and it doesn't work. so just leave it alone :P

Enjoy ;)

Php Code: Text to Smileys

okay just upload it to any website, and have $msg at everything you want to have a smiley face. YOU MUST HAVE THE SMILEY FILE NAME ON YOUR WEBSERVER/WEBSITE THE TEXT HAS TO BE THE SAME :p won't be the same as :P

Php Code: Upload file for your website

You must first create upload.htm & upload.php

This is uploader for your site. this code can upload avi , file , jpg , gif