24May03 HAM LOG SOFTWARE Ward Willats / KG6HAF / ward@kg6haf.com INTRODUCTION '''''''''''' In late 2002 and early 2003 I started a rewrite of phpHamLog. This archive contains the PHP and mySQL source code for the system. I never finished development however, as once I got things displaying nicely I just generated an ugly little editor using phpMyEdit and never completed an integrated editing form of my own. All of the architecture for it is roughed in, however. phpHamLog lives on SourceForge at: http://sourceforge.net/projects/phphamlog/ As I wrote on my web site in late 2002, I wanted a simple station logging program I could use to make my log available to everyone. As a new ham, my needs were simple, so I just needed some basic record keeping and the ability to deploy on the web. Not getting locked into a proprietary Windows solution would be a plus too. phpHamLog looked like what I wanted, but the source for that was in tough shape. My log differs from it in these respects: * Uses PHP objects (instead of procedural code) to encapsulate program functions. Object oriented. * Strict separation of code, HTML and styles. * Uses stylesheets for appearance control. No tables. * Separates editing and viewing functions so they can be deployed separately. (Typically, only the site administrator/control operator needs to see and use editing features.) * Since I separated the editing stuff out, I removed the PHP session logic and login requirements. Editing access control is provided by Apache realm authentication, and by deploying editing scripts in protected directories To make porting easier, I have kept the phpHamLog database schema, even though the "qso" table used is non-normalized and cumbersome. This is free software released under the GNU Public License. INSTALLATION '''''''''''' Requirements: I developed this on a Debian Linux box running mySQL 3.23 and PHP 4.1.2. I didn't make any extrodianry effort to support PHP 3. I assume you have PHP, mySQL and Apache installed. 1. Expand the archive into a directory on your web server. 2. Create the "qso" table. I've included the file "logbook.sql" you can feed into mysql to do this. This is the same database structure used by phpHamLog, so if you have that installed already you don't need to do anything. Example: mysql -p < logbook.sql The ituzones table in logbook.sql is not used by this system, but phpHamLog made it and so I do too. You can drop it if you want. 3. Edit CConfig.php and provide mysql host, username and access info. Also plug in your main callsign. 4. Configure PHP include path to look in both the directory you unpacked the archive into, and the "admin/" subdirectory. You can do this with an .htaccess file, a php.ini file, or in Apache's httpd.conf. I use the latter. ServerName XXXXXXX php_value include_path:/home/www-kg6haf/log/:/home/www-kg6haf/log/admin/ 5. I like to hide PHP from the user, so you also need to configure Apache to execute PHP for HTML files in this vhost. (I know this is unsual). So: ServerName XXXXXXX AddType application/x-httpd-php html phtml php AddType application/x-httpd-php-source phps php_value include_path:/home/www-kg6haf/log/:/home/www-kg6haf/log/admin/ Don't forget to send a reload signal to the http daemon. 6. If you want to restrict access to the admin functions, use the Linux htpasswd function to put an .htacess file in the "admin/" subdirectory using basic realm authetication. Example: htaccess: AuthUserFile /home/www-kg6haf/log/admin/.htpasswd AuthName "Ham Log Admin" AuthType Basic require valid-user htpasswd: secret! You should now see (a possibly empty) log when you access the URL where you unpacked the files. CONTENTS '''''''' ./CConfig.php - object that holds local config info for system ./CHLDatabase.php - ham log database subsystem ./CHLView.php - ham log entry viewer/pager ./README - this file ./WDebug.php - a debug tracer that writes to /tmp/php.log ./hamlog.css - stylesheet for hamlog ./index.html - main index, public viewing page of hamlog ./logbook.sql - dump file to create qso table ./admin - administration subdirectory ./admin/CHLEdit.php - ham log editor (new, edit, delete) ./admin/CHLForm.php - ham log new/edit form ./admin/index.html - main editing/admin page OBJECT HIERARCHY '''''''''''''''' CDatabase - low-level generic database | \/ CHLDatabase - database that knows about the schema, QSO table. All SQL is here. CHLView - A HamLog viewer that does paged display of Ham | Log entries, QRZ lookup, etc. | +--> CPager - A helper object a viewer has to keep track of | paging through the result set | \/ CHLEdit - An extension of the viewer that adds facilities | to edit and delete QSOs and create new ones | +--> CHLForm - A helper the editor has that provides the
for editing and creating QSOs (unfinished) - A CHLDatabase IS-A CDatabase - A CHLView HAS-A CDatabase and a CPager - A CHLEdit IS-A CHLView and HAS-A CHLForm - A CHLForm has a CDatabase System operation is controlled through GET params, that percolate from the most derived object to the base. In full-blown editing, the CHLForm gets first crack, then the CHLEdit and finally the CHLView. This is sort of like handling events in a window system. CODING CONVENTIONS '''''''''''''''''' Even though I hate Microsoft and all, I do think prefix notation is useful, especially in an untyped language like PHP. So kill me. In the source you will see: $szXXXX - variable is a string $nXXXXX - variable is a number $bXXXXX - variable is a boolean TO DO ''''' CHLForm and CHLEdit need to be finished, and routines added to CHLDatabase to support their operation. hamlog.css should be used to style the qso edit/create form. As I say, I just generated a quick and dirty editor using phpMyEdit and I've been using that instead of an integrated form, but this is not ideal. I'm just lazy. BUT, if you want to do the same, phpMyEdit lives at: http://phpMyEdit.org/home.php I hope you find this useful. I hope it gets finished someday too! 73, -- Ward / KG6HAF