Error Correction on Guestbook

I am trying to test the ArdGuest - Free PHP Guestbook Script on a production server before installing on website.
I get the fllowing PHP Warning: eregi() [<a href=‘function.eregi’>function.eregi</a>]: REG_EMPTY in C:\CustomerData\\index.php on line 601. [I]I have marked line 601 in the code below.


function is_spam($string) {
	            $data = "spamwords.dat";
	            $is_spam = false;
	  if (file_exists($data)) {
		$spamword = file($data);
		$jmlrec = count($spamword);
		for ($i=0; $i<$jmlrec; $i++) {
		$spamword[$i] = trim($spamword[$i]);
line 601	  if (eregi($spamword[$i],$string)) {
		$is_spam = true;

What is causing the error and how can it be corrected?

Thanks, It is testing out as required now. It was probably something to do with write permissions on the server. Thanks again.:blush:

Just get rid of the echo I told you to insert :slight_smile:

If you want to actually read what has been echoed, add an exit() before you do the redirect to the listing.

Thanks guido2004,

I tried the above insert and also checked to ensure no blank lines in spamword file!

When the Submit button is clicked - just for a split second :blush: the spamword file detail appears in the background before the guestbook listing is presented!
Testing link remains at

Might there be a simple workaround to eliminate the brief appearance of the spamword file detail from the screen?

Do an echo of $spamword[$i] just before that line:

echo "spamword $i: '" . $spamword[$i] . "' <br />";
if (eregi($spamword[$i],$string)) {

Maybe there’s an empty line in your spamwords.dat?