ASPit - Totally ASP
Search PHPit

Use this textbox to search all the content on PHPit. Seperate keywords with a space.

Advertisements
Partners
  • pozycjonowanie
  • Ionic Breeze Quadra
  • Myrtle Beach Real Estate
  • Online Education
  • Tanie cyfr√≥wki

Miscellaneous Codesnippets

iif function

The IIF function is a well-known function in most languages, however PHP does not contain such a function. It does now, if you include this function into your php files.

PHP Amazon Web Services Class

This class, written by Dennis Pallett, is used to query Amazon Web Services (a developers' token is required), and retrieve results from Amazon. The class includes automatic caching for increased stability and speed of your website.

Ban certain IP addresses

Using this handy codesnippet you can easily ban several troublemakers from your website. Please note though that this is far from foolproof, and people can very easily get around it, by using a proxy or changing their IP address (e.g. dial-up users, AOL users, etc).

FTP Upload

This codesnippet can be used to login into a FTP server, and then upload a file. Common use might be for backup purposes on a off-site FTP server.

Encode e-mail address

Use this handy function to encode e-mail addresses so it still looks good to humans, but can't be read by (spam) bots.

Crop sentence

Use this handy function, written by David Speake, to crop a sentence to a certain length. This function makes sure the words don't get broken up in the middle.

Sort array alphabetically

This function, used in conjunction with the usort() function, allows you to sort a n array alphabetically, e.g. usort($feeds, "cmp");

Get month name

This function changes a numerical month (e.g. 3) into the name of that month (e.g. March).

Javascript Redirect

With this function you can easily redirect to another page, after a certain amount of time (in seconds).

Javascript GoBack

This function can be used to redirect to the previous page, after a certain amount of time (in seconds).