Greetings.

    I have made a try to write a search engine for a site I run. This search
iterates through all links which are made up like so:
"|BY|EMAIL|CATEGORY|FOLDER/BAND|LINKNAME|LINKURL|". Now, I use the code:

 if ($txtLinkname=="") return;

    $logfile="entries.txt";
    $file_line = file($logfile);
    $total_lines = count($file_line);

    // Start printing the header of the table. The rest is completed, nested
    // course.. in the incrementation-loop.

    echo"<table width=60% cellpadding=0 border=0 cellspacing=0
align=center>";
    echo"<tr><td width=100% valign=top align=left>";

    for($i=($total_lines-1); 0 <= $i; $i--) { $line[] = $file_line[$i]; }

    echo "<p><b>Searching for links containing $txtLinkname...<br>";
    echo "<hr noshade>";
    echo "</b>";
    for ($i=0; $i < $total_lines; $i++){
        $line_array = explode("|",$line[$i]);

        $swhere=strtolower($line_array[5]);
        $swhat=strtolower($txtLinkname);

        $pos = strpos ($swhere, $swhat);
        if ($pos<0) {
            // not found

        }else if (($pos>1) && (!empty($pos))) {
            $found++;

            echo"<b>Name:</b> $line_array[1]<br>\n";
            echo"<b>Email:</b> <a
href=\"mailto:$line_array[2]\">$line_array[2]</a><br>\n";
            echo"<b>Category:</b> $line_array[3]<br>\n";
            echo"<b>Band/Folder:</b> $line_array[4]<br>\n";
            echo"<b>Link Name:</b> $line_array[5]<br>\n";
            echo"<b>Link URL:</b> <a href=\"$line_array[6]\"
target=\"_blank\">$line_array[6]</a><br>\n";
            echo "<hr noshade>";
        }


 }
        echo "<h3>";
        if ($found==0) {
            echo "No links found containing '$txtLinkname'!<br>";
        }else{
            echo "<br>Found: $found links containing $txtLinkname<br>";
        }

        echo "</h3><h4>";
        echo "[ <a href=\"post3.htm\">POST LINK</a> | <a
href=\"index.php?action=view\">VIEW LINKS</a> ]";
        $found=0;
 echo "</h4>";
  ?>




And that is all the code I use. Where have I done wrong? You see, the
problem is that I found only some links, but not all. And if I have a link
called "Necrolust - Tribute to MayheM", it cannot find the "Necro" nor
"necRO". And as you can see, I HAVE used uppercase methods to find portions
and so forth. Any help is suggested!!

- Richard



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to