HELLO
I AM
JOHN

I've been breaking making websites for over 15 years.

Embed Text in an Image with PHP

Sometimes, you just need to embed text directly into an image. The need to do so arose a few months ago for me. We had set up a jQuery carousel for our client, which displayed an image for triathlon events they were hosting. On each image, the name of the event had to be prominently displayed, and it had to cleanly rotate along with the images as they went around the carousel. The simple solution would have been to simply pop each image in photoshop/gimp and BAM. But they were not comfortable editing the images, and were going to be changing the slides frequently. The solution I came up with was to embed the event name into the image on-the-fly.
Read more

Share

Suckerfish Style Menus in Drupal 6.x

drupalI spent hours and hours hunting around for a simple solution to implementing suckerfish-style drop-down menus in Drupal 6. Lo-and-behold, I couldn’t find one. Every solution out there was overly complicated, and didn’t quite do what I wanted it to.

After a few hours of hacking around, this is the solution I came up with.

Read more

Share

On-The-Fly Dynamic Thumbnails with PHP

jpgI hate thumbnails. There. I’ve said it. Well… I suppose hate is a strong word… but I seriously strongly dislike them. I guess it’s not the thumbnails themselves I hate… it’s the extra work involved. Open up the image, crop, resize, save, upload, not right? rinse, lather, repeat until right.

To save myself the time (and sanity), I compiled this script… Read more

Share

PHP/Javascript File Uploader

uploadRecently one of our clients was in need of the ability to upload files to their webserver. This was easily accomplished with PHP’s built in functionality. But the draw back to this approach was that end-user had little or no indication that anything was happening.

Now we all know what happens. Typical scenario: User clicks a button. Seemingly nothing happens… *click*…. *clickety-click*… *CLICK CLICK CLICK*. Refresh, Reload. We all know how impatient some people can get. Specially when they don’t see the immediate gratification that is seeing something react when you push a button.
Read more

Share

Validate and Escape Data to Prevent SQL Injection

sql-injectionSo we’re back on the topic of SQL Injection, and how to prevent them with PHP. This subject, while often discussed, is not taken as seriously as it should be by many a web-developer, whether it be because of laziness, or merely due to lack of knowledge. Assuming the latter is the most common cause, I felt that I should elaborate a little more on my previous article on the topic.
Read more

Share

Mimic AJAX Form Posts with PHP, Javascript, and Cookies

I was recently reading various articles on how to load external pages using javascript and loading the results into a container div, mimicing that aspect of AJAX requests. But the main complaint I read was that you couldn’t POST. I thought it would be neat to figure out a way to do this, so after toying around with a few ideas, I came up with this dirty little method of posting form fields through javascript, passing the fields and values to php script through cookies, placing them into the $_POST array, and proceeding with business as usual.

Note that this method requires that the user has Javascript and cookies enabled. Also note that there is absolutely NO USE of the XmlHttpRequest object.
Read more

Share

Preventing SQL Injection with PHP

sql injectionSQL Injection. We’ve all heard the term. But what exactly is it? Sounds dirty and vile… or maybe something you get at the doctor’s office. A new type of plastic surgery maybe? Well, let’s find out, shall we?

From Wikiedpia.com:

SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.

Read more

Share