SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    Rep of Ireland
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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\shopdemo.webitry.net\index.php on line 601. I have marked line 601 in the code below.

    Code:
    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;
    		break;
    			}
    What is causing the error and how can it be corrected?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Do an echo of $spamword[$i] just before that line:
    PHP Code:
    echo "spamword $i: '" $spamword[$i] . "' <br />";
    if (
    eregi($spamword[$i],$string)) { 
    Maybe there's an empty line in your spamwords.dat?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    Rep of Ireland
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 the spamword file detail appears in the background before the guestbook listing is presented!
    Testing link remains at www.shopdemo.webitry.net/index.php

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

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by webiter View Post
    Might there be a simple workaround to eliminate the brief appearance of the spamword file detail from the screen?
    Just get rid of the echo I told you to insert

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

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    Rep of Ireland
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, It is testing out as required now. It was probably something to do with write permissions on the server. Thanks again.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •