Jump to content

Site links help


Johnnnnny1986

Recommended Posts

Ok im having problems stoping site links being posted on my wap site im using php 4 and i can only manage to stop certain links i want to stop all i use this code to stop one link
$gbvalues=str_replace('http://www.site.co.uk','<img src="image/hatespammers.gif" alt="(hatespammers)',$gbvalues);
and that replaces the link with my hate spammers icon. But it only stops [a href=\"http://www.site.co.uk\" target=\"_blank\"]http://www.site.co.uk[/a] from being put up in the forums. Please help thanks in advanced
Link to comment
Share on other sites

[!--quoteo(post=350192:date=Feb 28 2006, 08:22 AM:name=Johnnnnny)--][div class=\'quotetop\']QUOTE(Johnnnnny @ Feb 28 2006, 08:22 AM) [snapback]350192[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Ok im having problems stoping site links being posted on my wap site im using php 4 and i can only manage to stop certain links i want to stop all i use this code to stop one link
$gbvalues=str_replace('http://www.site.co.uk','<img src="image/hatespammers.gif" alt="(hatespammers)',$gbvalues);
and that replaces the link with my hate spammers icon. But it only stops [a href=\"http://www.site.co.uk\" target=\"_blank\"]http://www.site.co.uk[/a] from being put up in the forums. Please help thanks in advanced
[/quote]

welcome to the forums! i hope you find a great deal of help here as i have. let's back up a step... in your forums, do you allow HTML to be entered? if so, you may just be able to run strip_tags() with a list of exceptions that you want to allow. that way, if you strip out all <a> tags, you'll get rid of all links. if you're not using HTML, if you can explain what text one has to write to produce a link, we can help you come up with a regex or pattern match to find and remove all links from a given set of text.

good luck!
Link to comment
Share on other sites

[!--quoteo(post=350193:date=Feb 28 2006, 08:25 AM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Feb 28 2006, 08:25 AM) [snapback]350193[/snapback][/div][div class=\'quotemain\'][!--quotec--]
welcome to the forums! i hope you find a great deal of help here as i have. let's back up a step... in your forums, do you allow HTML to be entered? if so, you may just be able to run strip_tags() with a list of exceptions that you want to allow. that way, if you strip out all <a> tags, you'll get rid of all links. if you're not using HTML, if you can explain what text one has to write to produce a link, we can help you come up with a regex or pattern match to find and remove all links from a given set of text.

good luck!
[/quote]

thanks ill have a look at that put could you tell me how i can set the site to become
src="image/hatespammers.gif" alt="(hatespammers)' please
Link to comment
Share on other sites

[!--quoteo(post=350200:date=Feb 28 2006, 08:33 AM:name=Johnnnnny)--][div class=\'quotetop\']QUOTE(Johnnnnny @ Feb 28 2006, 08:33 AM) [snapback]350200[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thanks ill have a look at that put could you tell me how i can set the site to become
src="image/hatespammers.gif" alt="(hatespammers)' please
[/quote]

well, if you want to replace ALL links in a block of text with that image, i would probably do something like this:
[code]
function dieSpammers($String) {
  $find = "|\<a(.+?)\>(.+?)\</a\>|i";
  $replace = "<img src=\"image/hatespammers.gif\" alt=\"(hatespammers)\" />";
  $String = preg_replace($find, $replace, $String);
  return $String;
}

echo dieSpammers($myText);
[/code]
Link to comment
Share on other sites

[!--quoteo(post=350207:date=Feb 28 2006, 08:43 AM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Feb 28 2006, 08:43 AM) [snapback]350207[/snapback][/div][div class=\'quotemain\'][!--quotec--]
well, if you want to replace ALL links in a block of text with that image, i would probably do something like this:
[code]
function dieSpammers($String) {
  $find = "|\<a(.+?)\>(.+?)\</a\>|i";
  $replace = "<img src=\"image/hatespammers.gif\" alt=\"(hatespammers)\" />";
  $String = preg_replace($find, $replace, $String);
  return $String;
}

echo dieSpammers($myText);
[/code]
[/quote]

Thanks
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.