Jump to content


Photo

Checking a text area for...


  • Please log in to reply
4 replies to this topic

#1 AncientSage

AncientSage
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 12 July 2006 - 02:12 AM

Hello,

Currently, I'd like to check a text area to see if there are any links, if so, check the href attribute for certain characters, and quit the script if they have those certain characters...

I'm guessing it would involve searching for "href" and all text assigned to href would then be checked by some php function, however, I don't know which functions would be used for any of this, if someone could list the functions needed, I'll do the research on them.

Thanks.

#2 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 12 July 2006 - 02:34 AM

would str_replace() work? I dont quite understand what ur trying to do!

or implode() make the links into an array then if they contain those letters use unset() to remove them from the array!
"Syntax error" .. WHERE THE **** IS IT?!

#3 AncientSage

AncientSage
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 12 July 2006 - 05:34 AM

Well, actualy...

I want php to find links if there are any, then find what is assigned to the href attribute, that being, the URL. For example, let's say someone enters the following HTML into a text-area...

{a href=http://www.phpfreaks.com/}Click Here{/a} (apparently, this forum allows HTML, so...replace { & } with the greater/lesser than symbols when reading)
I'd want php to find what is assigned to href, then for example, if it contains the characters php, then I'd want script to end and return an error.



#4 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 12 July 2006 - 05:53 AM

Take a look at explode function, then take a look at preg_match...

Explode on the ' ' character.. then use preg_match as you skip through the array using a foreach loop.

I can help you further, but take a look at php.net for some help.

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#5 AncientSage

AncientSage
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 12 July 2006 - 06:10 AM

Thanks, and I should be able to take it on my own from here, the preg_match function seems to be able to do what I want it to do.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users