/******** making text version of newsletter ******/ $subscribe = "news/subscribe.txt"; $file4 = fopen("$subscribe", "w"); $day=3; $sub=mysql_query("select sid, aid, title, time, hometext, topic, informant from $prefix"._stories." where (TO_DAYS(NOW()) - TO_DAYS(time)) <= $day order by time DESC"); while(list($sid, $aid, $title, $time, $hometext, $topic, $informant) = mysql_fetch_row($sub)) { $sub2=mysql_query("select topictext, topicimage from $prefix"._topics." where topicid=$topic"); list($topictext, $topicimage) = mysql_fetch_row($sub2); $hometext = nl2br($hometext); $hometext = ereg_replace("<a[^>]*href[[:space:]]*=[[:space:]]*\"?[[:space:]]*([^\" >]*)[[:space:]]*\"?[^>]*>([^<]*)</a>","\\2",$hometext); # убираем все встречающиеся в тексте гиперссыки, чтобы не портили внешний вид текстовой версии $content = "$title\r\n$hometext\r\nhttp://www.yourdoamin.com/article.php?sid=$sid\r\n\r\n"; fwrite($file4, $content); } fclose($file4); /*****************************************************/ |