Articles

This page contains articles, guides or tutorials related to several subjects such as PHP, Javascript, etc.

IFrame height auto resize

Filed under:  Google about "Javascript"

Have you ever found the need to display documents behind IFrames? Wondering how the height could be automatically adjusted to the IFrame contents, so it doesn't display scrollbars?

Well, here's a quick yet effective way to solve this problem by means of a simple javascript file that you just need to add in the header of your pages.

Note though that the solution presented here will not work for documents located on different domains.

Ok, let's see...


Setting up PHP Sessions?

Filed under:  Google about "PHP"

While using the net, you may have seen web sites that require your browser to support cookies. The reason why, in my opinion, is simple. Such a requirement is another layer in the battery of security measures available to webmasters. This one is aimed to minimize the possibilities of session related attacks. It is just a reasonable "restriction" at a minimal cost when critical transactions are involved. Probably, all potential users of such interaction have browsers with cookie capabilities. It's a matter of balance.

If you run a web application that relies on PHP sessions, why not do the same online banks or ecommerce sites do? Ah... what would you loose? What would you win? Well, obviously I'm for doing so. Here, I'll try to point non-developers to some information to help them decide. Then I propose (and describe how) to require cookies for session's tracking while taking advantage of browser security features to protect those cookies (on the client side) and also make sure PHP will never append the SID to URLs.


Dynamic TextArea Resizer

Filed under:  Google about "Javascript" |  Google about "phpBB"

The first time I saw a resizable textarea was using TinyMCE, then I've seen this implemented in WordPress, then in Drupal. After some time, I started to feel consumed by the need to find this feature in other tools that I often use too, such as phpBB... here's where I finally decided to do something about it, but rather than writing a phpBB MOD, I decided to write a generic DYNamic TextArea Resizer (DYNTAR), a standalone javascript snippet that's easily plugable to any website. It's pretty small, coded with a non-intrusive approach and it should work on any DOM capable browser.

This article explains how it works and how you can add this gadget to your own website.


How to create a dynamic signature?

Filed under:  Google about "PHP"

This tutorial just shows you one of lots of possible implementations to create dynamic signatures. A dynamic signature is a banner image which is dynamically generated by a small script. So you can use a default background image and write over it any information. The limit is your own imagination.

Actually, I'm going to explain how I implemented mine and post the resources I used. As I believe it might be useful to share the basics. I hope you learn something, as well as I did, sometime ago. ;)

The samples used here use a GIF image for the background and generate a PNG image using GD functions present in almost all PHP installations. So, if you need another approach, you should change the relevant pieces in the code itself to adapt the samples to your own needs.