Code To Go
Programs and code snippets listed on this page are licensed under the
GNU General Public
License and may be used and shared freely.
choosestyle.php - Grant Root - 3/10/03
This snippet of code demonstrates how to choose and link to an appropriate
stylesheet for a site based on the user agent (browser). It uses PHP's
get_browser function, and caches the resultant data using a session variable so
that the function is not called for every page access.
docsecure.php - Grant Root - 12/2/04
This snippet of code demonstrates how to secure a collection of documents
by assigning a PHP program as a "handler" for a file type in Apache. Could also be used to
do other processing, such as adding special headers or logging access to documents. It requires
the mod_action Apache module and some setup in the Apache config file or in .htaccess.
weatherbox.php - Grant Root - 1/15/06
This routine builds a "weatherbox" display suitable for inclusion in the side
bar of a web page. It accepts a zip code from a user, looks it up at the
Weather Underground site, and obtains a locality path such as "US/OH/Dayton".
This locality is then stored as a cookie on the user's system.