Jump to content


Photo

replacement within a string


  • Please log in to reply
1 reply to this topic

#1 oli_62

oli_62
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 01 May 2006 - 07:42 PM

Hello

I have a guestbook with a .txt file as guestbook entry storage. Now I want make a spam protection and therefore I want replace the E-Mail address in the output.

My .txt file has the following syntax:

<b>Datum:</b> Sun 04/30/06 8:56PM<br><b>Von:</b> admin<br><b>Email: </b><a href=mailto:admin@domain.tld>admin@domain.tld</a><br><br><b>Eintrag:</b>

Now I want replace the following section within the string:

<a href=mailto:admin@domain.tld>admin@domain.tld</a>
<a href=mailto:%</a>

$buffer = fgets($fd, 4096);

$lines[] = $buffer;

Thanks for help!

oli

#2 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 01 May 2006 - 07:52 PM

you'd use regex for that...

and if you use fgets you'd run a loop
regexing each line, each iteration

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users