diff -urp click_heatmap/click_heatmap.log.inc _click_heatmap/click_heatmap.log.inc
--- click_heatmap/click_heatmap.log.inc	2008-02-11 11:06:29.000000000 +1100
+++ _click_heatmap/click_heatmap.log.inc	2008-02-11 11:53:53.000000000 +1100
@@ -146,7 +146,7 @@ function click_heatmap_log_generate() {
   $days = 7;
   for ($day = 0; $day < $days; $day++) // Last 7 days.
   {
-    $date_stamp = $_SERVER['REQUEST_TIME'];
+    $date_stamp = time();
     $current_date = date('Y-m-d', mktime(0, 0, 0, date('m', $date_stamp), date('d', $date_stamp) - $day, date('Y', $date_stamp)));
     $clicks_heatmap->addFile(realpath(drupal_get_path('module', 'click_heatmap') .'/clickheat/logs/') .'/'. $_GET['page'] .'/'. $current_date .'.log');
   }
@@ -182,7 +182,9 @@ function click_heatmap_log_get_pages() {
 
   $site_name = strtolower(str_replace(' ', '.', variable_get('site_name', 'Drupal Click Heatmap')));
   $length = strlen($site_name);
-  $files = scandir(drupal_get_path('module', 'click_heatmap') .'/clickheat/logs/');
+  $path = opendir(drupal_get_path('module', 'click_heatmap') . '/clickheat/logs/');
+  while (false !== ($filename = readdir($path)))
+    $files[] = $filename;
   foreach ($files as $file) {
     if (strpos($file, $site_name) !== FALSE) {
       // Transform directory name into page information.
diff -urp click_heatmap/click_heatmap.module _click_heatmap/click_heatmap.module
--- click_heatmap/click_heatmap.module	2008-02-10 05:54:29.000000000 +1100
+++ _click_heatmap/click_heatmap.module	2008-02-11 11:54:06.000000000 +1100
@@ -94,7 +94,7 @@ function click_heatmap_footer() {
       clickHeatServer = '". url(drupal_get_path('module', 'click_heatmap') ."/clickheat/click.php", NULL, NULL, TRUE) ."';
       initClickHeat();",
       'inline', 'footer');
-    return '<script type="text/javascript" src="'. drupal_get_path('module', 'click_heatmap') .'/clickheat/js/clickheat.js"></script>'."\n";
+    return '<script type="text/javascript" src="'. base_path() . drupal_get_path('module', 'click_heatmap') .'/clickheat/js/clickheat.js"></script>'."\n";
   }
 }
 
@@ -200,7 +200,21 @@ function click_heatmap_settings_validate
         'alpha' => 80,
         'version' => '1.7'
       );
-      file_put_contents($real_path .'/config/config.php', '<?php $clickheatConf = '. var_export($config, TRUE) .' ?>');
+
+      //PHP 4 alternative to file_put_contents()
+      if (!function_exists('file_put_contents')) {
+        $fh = @fopen($real_path .'/config/config.php', 'w');
+        if ($fh === false) {
+          //This probably needs to be changed
+          return false;
+        }
+        $data = '<?php $clickheatConf = '. var_export($config, TRUE) .' ?>';
+        $data = (string) $data;
+        $bytes = fwrite($fh, $data);
+        fclose($fh);
+      }
+      else
+        file_put_contents($real_path .'/config/config.php', '<?php $clickheatConf = '. var_export($config, TRUE) .' ?>');
       drupal_set_message(t('Configuration file created. Please removed write permissions to <i>/click_heatmap/clickheat/config/</i>.'));
     }
   }
