hbmarar 0 Junior Poster

Hi ,

Wishes.

I have developed a commenting system and it work as follows. first comment would be X. All reply to this would be X.X and reply to X.X would eb as X.X.X likewise. I keep each level's maximum filename used using a count file.

I use the below code to write the count file:
function safeFileWrite($level, $count)
	{
		$fp = fopen('count'.$level.'.txt',"wb");
		if (flock($fp, LOCK_EX)) 
		{
			 fputs($fp,$count);
			 flock($fp, LOCK_UN);
		} else {
			 echo "Error locking a file, please try again later!";
		}
		fclose($fp);
	}

Would this cause concurrency issue. would it break in a heavy traffic site of one user in each second sites.

Thanks in advance for the help.

With regards

Harish