Please help and improve this script for displaying search results
A couple of small things...

I would replace this:

if (strstr($lines[$i], $keywords[0]) || strstr($lines[$i], $keywords[1]) || 
    strstr($lines[$i], $keywords[2]) || strstr($lines[$i], $keywords[3])


with something like:

foreach($keyword in $keywords) {
    if (strstr($lines[$i]) {
       $j++;
       $line .= trim($lines[$i])."...";
       break;
    }
 }


Also, this line:

       $line .= trim($lines[$i])."...";


will result in an extra trailing "..." when $j gets to 2.  I'm presuming you want something like "line1...lineN", but instead you'll get "line1...lineN...".  You probably want to chop off those extra dots, or only add them when needed.