Just in case anyone else is still interested in this script I am posting the most current version that I am using now. It works on CPG 1.5.x. Mostly the changes involved dealing with positioning, the previous absolute positioning didn't work well. The positioning is only used if you want some of your pics sorted by EXIF date and others you want to specify the position manually. TO do this you indicate which ones you want to position manually using the lipos variable. Other changes involve correctly escaping the strings prior to sql updates and directly accessing the db rather than using the CPG calls. There are a lot of echo statements which can be ignored/removed. To start set up the lines 130/131 for database access.
To use this script you would need to change all of the cpg1410_ prefixes to match your database. Also this version of the script uses this table:
CREATE TABLE IF NOT EXISTS `cpg1410_mytempdata` (
`album` int(11) NOT NULL DEFAULT '0',
`pid` int(11) NOT NULL DEFAULT '0',
`orig_position` int(11) NOT NULL DEFAULT '0',
`orig_ordinal` int(11) NOT NULL DEFAULT '0',
`rec_position` int(11) NOT NULL DEFAULT '0',
`rec_ordinal` int(11) NOT NULL DEFAULT '0',
`final_position` int(11) NOT NULL DEFAULT '0',
`final_ordinal` int(11) NOT NULL DEFAULT '0',
`maxposforalbum` int(11) NOT NULL DEFAULT '0',
`maxordinal` int(11) NOT NULL DEFAULT '0',
`albumandposition` varchar(16) NOT NULL DEFAULT '',
`exifdatearrkey` varchar(35) NOT NULL DEFAULT '',
`filepath` varchar(20) NOT NULL DEFAULT '',
`filename` varchar(20) NOT NULL DEFAULT '',
`goodexifdate` char(1) NOT NULL DEFAULT '',
`cameramodel` varchar(20) NOT NULL DEFAULT '',
UNIQUE KEY `exifdatearrkey` (`exifdatearrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;