--- knurl.module.orig
+++ knurl.module
@@ -90,10 +90,12 @@
   $output .= '<table style="margin:0px;padding:0px;"><thead><tr>';
   $output .= '<th style="width:80%">Target URL</th>';
   $output .= '<th style="width:20%">knurl</th>';
+  $output .= '<th style="width:20%">clicks</th>';
   //$output .= '<th style="width:20%">Action</th></tr></thead>';
   while ($node = db_fetch_object($res)) {
     $output .= '<tr><td>' . wordwrap($node->link, $url_limit, "<BR>", true) . '</td><td>';
     $output .= l(_get_server_url() . '/url/' . $node->short_url, 'url/' . $node->short_url);
+    $output .= '</td><td>'. $node->count .'</td><td>';
     $output .= '</td>';//<td>' . l("delete", 'knurl/remove/' . $node->short_url) . '</td></tr>';
     // why do we need to delete anyway?  commented out by Sam Placette, 9-26-07
   }
@@ -128,9 +130,14 @@
 function knurl_redirect() {
   $short_url = end($args = func_get_args());
   $res = db_fetch_object(db_query("select * from {knurl} where short_url='%s'", $short_url));
-  if(!$res) return drupal_not_found();
-  else return drupal_set_header("Location: ".$res->link);
+  if(!$res) {
+   return drupal_not_found();
+   }
+  else {
+   db_query("UPDATE {knurl} SET count = count + 1 WHERE short_url='%s'", $short_url);
+  return drupal_set_header("Location: ".$res->link);
   // else return drupal_set_html_head('<meta http-equiv="refresh" content="0;url='.$res->link.'"/>');
+  }
 }
 
 // form for adding a new knurl
