Web Dev Blog

Looking for help with WordPress, Apache, Vim, Web Security and more. Here are a few tips.

Category: web design

global.inc.php and pt_register from phpFormGenerator is broken and not working

There is a tool that used to come with the cpanel installation on some of the bigger hosts (hostgator, bluehost, etc…) call phpFormGenerator.  This tool would let you create forms in a GUI and then give you code to upload to your website.

Part of this code was a file called global.inc.php.  global.inc.php included code that read the session variables that were passed to the post.  At the time it was written PHP3 was in common use and a function called pt_register was included that made assigning the value from a form field to a variable a little easier (it was kind of clunky at that point).

Basically you would have something like

pt_register('POST','Foo');

This would assign the contents of form field Foo to a variable $Foo.  The way this was accomplished was inherently unsafe and has been removed completely from current versions of PHP (PHP5.5).

If you have moved a site to a server running php 5.5 that uses this code the forms will be broken.

Thankfully there is an easy fix.  Form field contents are now put into the $_POST variable.  This means you can replace the pt_register call with this

$Foo = $_POST['Foo'];

Exact same thing is accomplished, just replace the pt_register lines in any form php files and the forms will work again.

Using CSS 3 @font-face for font rendering

There are multiple methods of creating custom fonts for web pages, Cúfon, sIFR, Google Web Fonts, etc… None of these have been a good fit for my projects until I looked into the CSS3 @font-face method. It’s simple to use and SEO friendly.

All you have to do is go to urbanfont.com, fontsquirrel.com or another good source of appropriate licensed fonts and pick out what you want.

Once you have the font files, use the @font-face generator at fontsquirrel.com to create a kit that includes all of the font files you need for browser support. Put the fonts and sample code in the appropriate places and update your CSS to use the new fonts. Walla, shiny new fonts on your web page.