diff -ru wwwcheck-0.4/index.php wwwcheck-0.41/index.php
--- wwwcheck-0.4/index.php	2005-03-03 14:54:48.000000000 +0900
+++ wwwcheck-0.41/index.php	2005-07-09 11:36:26.000000000 +0900
@@ -45,16 +45,14 @@
 // measures against CSRF
 if ( $post->get() ) {
 	$uniq_id = $post->get( 'uniq_id', '' );
-	$result  = Command::is_csrf( $uniq_id );
+	$result  = Command::isCsrf( $uniq_id );
 	if ( $result ) {
 		Command::redirect();
 		exit;
 	}
 }
 else {
-	$uniq_id = Command::createUniqID();
-	$conf->set(	'uniq_id', $uniq_id );
-	$conf->save();
+	Command::createUniqID();
 }
 
 switch ( $mode ) {
diff -ru wwwcheck-0.4/init.inc.php wwwcheck-0.41/init.inc.php
--- wwwcheck-0.4/init.inc.php	2005-03-20 01:38:02.000000000 +0900
+++ wwwcheck-0.41/init.inc.php	2005-07-17 00:32:14.000000000 +0900
@@ -1,10 +1,11 @@
 <?php
 
 define( 'TOOL_NAME',    'wwwcheck.php' );
-define( 'TOOL_VERSION', '0.4' );
+define( 'TOOL_VERSION', '0.41' );
 
 umask( 0070 );
 ob_implicit_flush( 0 );
+ini_set( 'display_errors', 0 );
 
 $script_name = 'index.php';
 $web_dir     = dirname( $_SERVER['PHP_SELF'] ) . '/';
@@ -41,7 +42,7 @@
 
 // prepare configuration object
 $conf =& Config::getInstance( $conf_file );
-if ( $conf === FALSE ) {
+if ( ! is_object( $conf ) ) {
 	// first access : setting default values
 	include( $self_dir . 'misc/default_setting.inc.php' );
 }
diff -ru wwwcheck-0.4/lib/baselib/config.inc.php wwwcheck-0.41/lib/baselib/config.inc.php
--- wwwcheck-0.4/lib/baselib/config.inc.php	2005-02-26 22:54:01.000000000 +0900
+++ wwwcheck-0.41/lib/baselib/config.inc.php	2005-07-09 11:37:40.000000000 +0900
@@ -17,13 +17,12 @@
 
 	function &getInstance( $file = '' )
 	{
-		static $instance;
+		static $instance = NULL;
 
 		if ( $instance === NULL ) {
-			if ( ! $file || ! is_readable( $file ) ) {
-				return FALSE;
+			if ( $file && is_readable( $file ) ) {
+				$instance = new Config( $file );
 			}
-			$instance = new Config( $file );
 		}
 		return $instance;
 	}
diff -ru wwwcheck-0.4/lib/baselib/daylog.inc.php wwwcheck-0.41/lib/baselib/daylog.inc.php
--- wwwcheck-0.4/lib/baselib/daylog.inc.php	2005-02-26 22:54:01.000000000 +0900
+++ wwwcheck-0.41/lib/baselib/daylog.inc.php	2005-07-09 11:37:40.000000000 +0900
@@ -27,13 +27,12 @@
 
 	function &getInstance( $dir = '' )
 	{
-		static $instance = NULL ;
+		static $instance = NULL;
 
 		if ( $instance === NULL ) {
-			if ( ! $dir || ! is_dir( $dir ) ) {
-				return FALSE;
+			if ( $dir && is_dir( $dir ) ) {
+				$instance = new DayLog( $dir );
 			}
-			$instance = new DayLog( $dir );
 		}
 		return $instance;
 	}
diff -ru wwwcheck-0.4/lib/baselib/net.inc.php wwwcheck-0.41/lib/baselib/net.inc.php
--- wwwcheck-0.4/lib/baselib/net.inc.php	2005-03-01 15:35:24.000000000 +0900
+++ wwwcheck-0.41/lib/baselib/net.inc.php	2005-07-09 11:26:00.000000000 +0900
@@ -53,7 +53,7 @@
 		}
 	}
 
-	function get( $uri, $headers = array(), $proxy = FALSE )
+	function &get( $uri, $headers = array(), $proxy = FALSE )
 	{
 		$net =& Net::getSubObject( $uri, (bool)$proxy );
 		$net->addHeaders( $headers );
@@ -86,7 +86,7 @@
 		return $this->status;
 	}
 
-	function getSubObject( $uri, $proxy )
+	function &getSubObject( $uri, $proxy )
 	{
 		$dir = dirname( __FILE__ ) . '/net/';
 		$arr = @parse_url( $uri );
diff -ru wwwcheck-0.4/lib/command.inc.php wwwcheck-0.41/lib/command.inc.php
--- wwwcheck-0.4/lib/command.inc.php	2005-03-03 13:54:06.000000000 +0900
+++ wwwcheck-0.41/lib/command.inc.php	2005-07-09 11:36:59.000000000 +0900
@@ -52,7 +52,7 @@
 		return array( 'INFO_CHANGE_SETTING', $arr['to_uri'] );
 	}
 
-	function checkSite( $uri )
+	function &checkSite( $uri )
 	{
 		$conf =& Config::getInstance();
 
@@ -99,7 +99,30 @@
 
 	function createUniqID()
 	{
-		return md5( uniqid( TOOL_NAME ) );
+		// TTL(time to live) 1800 sec.
+		$ttl = 1800;
+
+		$conf =& Config::getInstance();
+		$curr = time();
+		$ids = $conf->get( 'uniq_ids', array() );
+		foreach ( $ids as $id => $time ) {
+			if ( $time < $curr - $ttl ) {
+				unset( $ids[$id] );
+			}
+			else {
+				$uniq_id = $id;
+			}
+		}
+		if ( count( $ids ) < 2 ) {
+			if ( ! $ids || ( $curr - (int)( $ttl / 2 ) ) >= max( $ids ) ) {
+				$uniq_id = md5( uniqid( TOOL_NAME ) );
+				$ids[$uniq_id] = time();
+			}
+		}
+		$conf->set( 'uniq_id', $uniq_id );
+		$conf->set( 'uniq_ids', $ids );
+		$conf->save();
+		return $uniq_id;
 	}
 
 	function deleteItem( $uri )
@@ -221,11 +244,12 @@
 		return '';
 	}
 
-	function is_csrf( $uniq_id )
+	function isCsrf( $uniq_id )
 	{
+		$ttl   = 1800;
 		$conf =& Config::getInstance();
-		$id    = $conf->get( 'uniq_id' );
-		if ( $uniq_id === $id ) {
+		$ids   = $conf->get( 'uniq_ids' );
+		if ( isset( $ids[$uniq_id] ) && $ids[$uniq_id] > time() - $ttl ) {
 			return FALSE;
 		}
 		return TRUE;
diff -ru wwwcheck-0.4/lib/filters.inc.php wwwcheck-0.41/lib/filters.inc.php
--- wwwcheck-0.4/lib/filters.inc.php	2005-02-26 23:08:20.000000000 +0900
+++ wwwcheck-0.41/lib/filters.inc.php	2005-07-16 23:06:21.000000000 +0900
@@ -63,7 +63,7 @@
 
 		foreach ( $this->patterns as $patterns ) {
 			if ( preg_match( $patterns['domain'], $uri ) ) {
-				$html =& preg_replace( $patterns['pattern'], '', $html );
+				$html = preg_replace( $patterns['pattern'], '', $html );
 			}
 		}
 		return $html;
diff -ru wwwcheck-0.4/update.php wwwcheck-0.41/update.php
--- wwwcheck-0.4/update.php	2005-02-26 23:08:20.000000000 +0900
+++ wwwcheck-0.41/update.php	2005-07-09 11:34:43.000000000 +0900
@@ -35,7 +35,7 @@
 		exit;
 	}
 	// POST only and not CSRF
-	if ( ! isset( $_POST['update'] ) || ! isset( $_POST['uniq_id'] ) || Command::is_csrf( $_POST['uniq_id'] ) ) {
+	if ( ! isset( $_POST['update'] ) || ! isset( $_POST['uniq_id'] ) || Command::isCsrf( $_POST['uniq_id'] ) ) {
 		Command::redirect();
 		exit;
 	}
@@ -84,7 +84,7 @@
 
 $count   = 0;
 $pids    = array();
-$process = 7;
+$process = 6;
 
 if ( extension_loaded( 'pcntl' ) && ( $sapi === 'cli' || $sapi === 'cgi' ) ) {
 
diff -ru wwwcheck-0.4/view/view_config.tpl.php wwwcheck-0.41/view/view_config.tpl.php
--- wwwcheck-0.4/view/view_config.tpl.php	2005-03-03 13:57:12.000000000 +0900
+++ wwwcheck-0.41/view/view_config.tpl.php	2005-07-16 23:06:21.000000000 +0900
@@ -10,10 +10,12 @@
 
 $serv =& Request::getInstance( '_SERVER' );
 
-$top_page    = $serv->get( 'PHP_SELF' );
-$filter_page = $top_page . '?mode=filter';
-$status_page = $top_page . '?mode=status';
-$config_page = $top_page . '?mode=config';
+$self  = $serv->get( 'PHP_SELF' );
+
+$top_page    = $self;
+$filter_page = $self . '?mode=filter';
+$status_page = $self . '?mode=status';
+$config_page = $self . '?mode=config';
 
 $self  = $config_page;
 $user  = $conf->isAuth() ? htmlspecialchars( $conf->get( 'user' ) ) : '';
diff -ru wwwcheck-0.4/view/view_status.tpl.php wwwcheck-0.41/view/view_status.tpl.php
--- wwwcheck-0.4/view/view_status.tpl.php	2005-03-03 13:57:12.000000000 +0900
+++ wwwcheck-0.41/view/view_status.tpl.php	2005-07-16 23:06:21.000000000 +0900
@@ -3,11 +3,13 @@
 $conf =& Config::getInstance();
 $cate =& Category::getInstance();
 $get  =& Request::getInstance( '_GET' );
+$self  = $serv->get( 'PHP_SELF' );
 
-$top_page     = $serv->get( 'PHP_SELF' );
-$filter_page  = $top_page . '?mode=filter';
-$config_page  = $top_page . '?mode=config';
-$setting_page = $top_page . '?mode=setting&amp;uri=';
+$top_page     = $self;
+$filter_page  = $self . '?mode=filter';
+$status_page  = $self . '?mode=status';
+$config_page  = $self . '?mode=config';
+$setting_page = $self . '?mode=setting&amp;uri=';
 
 $self  = $config_page;
 $last  = $conf->get( 'last-modified' ) ? date( "Y/m/d H:i:s", $conf->get( 'last-modified' ) ) : '';
