Clive Walkden

PHP, MySQL, HTML5, CSS3, jQuery code and ideas.

PHP Posts | My Blog

Composer Self Update

Composer Self Update


in PHP
by
with 0 Comments

Composer is rocking my life at the moment, the only issue I have is I keep forgetting to update the main composer.phar as sudo.
Read more
PHP function to generate a random password

PHP function to generate a random password


in PHP
by
with 0 Comments

This handy little function generates a random password using alphanumeric characters. It may not be the most secure but it beats a standard dictionary word and could help secure your users accounts.
Read more
PHP function to find links in a string

PHP function to find links in a string


in PHP
by
with 0 Comments

This handy little function searches a string for urls and converts them into anchor tags. This is particularly useful for tweets pulled from Twitter using the API. This is used to prepare the links in my Twitter feed at the bottom of my site.
Read more
PHP Email Address Validation Function

PHP Email Address Validation Function


in PHP
by
with 0 Comments

One PHP function that i like to use in my validation routines is this little beauty.
Read more
PHP Snippet to convert UK date to MySQL date

PHP Snippet to convert UK date to MySQL date


in PHP
by
with 0 Comments

A simple PHP preg_replace statement that will convert uk date format ready to be inserted into a mysql table. 23/06/1981 returns 1981-06-23
Read more
PHP Filename Friendly Function

PHP Filename Friendly Function


in PHP
by
with 0 Comments

This function outputs a string that is filename friendly. It removes all non-characters and punctuation from the input and converts to lowercase. I find this useful for seo friendly cms pages. This function is still being tweaked so any improvements would be most appreciated. function checkCharacters($title) { $final_text = ”; $title = strtolower(trim(stripslashes($title))); for ($i = 0; $i < strlen($title); $i++) { $letter = substr($title,$i,1); $ascii =...
Read more
PHP Function to find the last key of a multidimensional array

PHP Function to find the last key of a multidimensional array


in PHP
by
with 0 Comments

This function is great for retrieving the last key of a multidimensional array. I use this function on a site that stores cake options such as size, shape, ribbon colour, icing colour and text fields for use in a shopping basket.
Read more
PHP Colour lightness function

PHP Colour lightness function


in PHP
by
with 0 Comments

  Following on from my other 2 useful functions I thought I would show you another one which I have found useful for determining if a colour background needs a white or black text colour over the top.    I found this function a while back so can't take the credit for writing it myself, I have no idea to give the credit to but whoever you are thank you.    [code lang="php"] function get_brightness...
Read more
PHP Function to return your IP address

PHP Function to return your IP address


in PHP
by
with 0 Comments

Here's a quick little function which can be used to return your IP address. Not as useful as the next method but a simple quick solution
Read more
PHP Function IP if behind a proxy

PHP Function IP if behind a proxy


in PHP
by
with 0 Comments

Following from my last post, here is the method to get your IP address if you are behind a proxy. It's a much better function than the earlier post as it will almost guarantee a return result.
Read more
Useful PHP date function

Useful PHP date function


in PHP
by
with 0 Comments

Here's a useful function that I use a lot for taking a database date and converting it into something human readable. [code lang="php"] function dateFormat($dbDate, $newFormat="jS F Y") { // split the date into it's component parts $year=substr($dbDate, 0,4); $month=substr($dbDate, 5,2); $day=substr($dbDate, 8,2); $hour=substr($dbDate, 11,2); $minute=substr($dbDate, 14,2); $second=substr($dbDate, 17,2); // reco...
Read more
Enemy Terriory Theme Released

Enemy Terriory Theme Released


in PHP
by
with 0 Comments

Uberthemes have released there latest PHP Nuke theme for clans playing Wolfenstein: Enemy Territory. The game which is free to download and play, came out a few years ago and it's combination of team based and objective led combat has kept it on the top 10 list of Xfire. Earlier this year a new updated version of the game was released under the Quake umbrella, but promised the same fantastic gameplay that the original had. Unfortunately upon playing t...
Read more
PHP MySQL Class

PHP MySQL Class


in PHP
by
with 0 Comments

Been using this class now for my sites for a while it's just the ticket. So i thought i'd include it here so that more people can benefit from it. I wish i could take the credit for producing this but unfortunately it was built by Eric Sizemore over at www.secondversion.com he's also produced a handy tool or tracking your domains. Well worth a visit. I couldn't find the files on his site so i've included the file here for download.
Read more