Got it working. After much consideration i decided to dump the idea of making the emailaddresses linkable because robots and such. Also decided to put the link underneith the original string so its not altered (except the at sign). few minor additions and someone else could get the email links working too.
so this is what i ended up with. still needs cleaned up but it works. Spent 6 hours on it yesterday and didn't get jack. spent an hour on it today and got it, darn mondays.
Thanks for the help 🙂
function back_class($cat) {
$res = mysql_query("QUERY REMOVED");
$cadc = mysql_num_rows($res);
while($row = mysql_fetch_array($res)) {
$t = trim(ereg_replace(" +", " ",$row[0]));
$class[] = eregi_replace("@", "[at]",$t);
}
foreach ($class as $str) {
unset($splen);
unset($link);
if (eregi("www.",$str) || eregi("\@",$str)) {
$sstr = split(" ",$str);
for ($i = 0; $i <= count($sstr); $i++) {
if (eregi("www",$sstr[$i]) || eregi("\@",$sstr[$i])) {
$akey = $i;
}
}
for ($i = 0; $i <= count($sstr); $i++) {
if(eregi(".com",$sstr[$i]) || eregi(".net",$sstr[$i]) || eregi(".org",$sstr[$i]) || eregi(".us",$sstr[$i]) || eregi(".uk",$sstr[$i]) || eregi(".edu",$sstr[$i])) {
$bkey = $i;
}
}
$splen = $bkey - $akey;
$splen++;
$lnkarry = array_slice($sstr,$akey,$splen);
$url=implode($lnkarry);
$link = "<br><a href=http://$url>$url</a>";
}
$piss[] = (isset($link)) ? $str . $link : $str;
} // end for
return $piss;
}