![]() |
Need some help with code
I have set up a new profile field but it is allowing url's, etc. into that field.
I would I set it up to strip html and url's from the field? Right now I am using which doesn't do much. Code:
if($profilefieldname == "field15") Parker |
Why not just use
Code:
if($userinfo['field15']) |
Thanks.
What I am trying to do is to strip all the HTML out of that field. Like the use of http, or www, or img src, etc. I apologize if I wasn't clearer the last time. Parker |
Techinally they aren't HTML so there is no predefined function for doing this, but you may be able to try this:
PHP Code:
|
Try the htmlspecialchars_uni() tag
|
PHP Code:
|
Sorry but neither examples used strip the html or www or img, etc. from
the feild. Thanks, Parker |
Do you mind posting the whole code? Are you using it exactly like Dismounted
|
Sorry, I have been working the last few days.
I created a plugin that used the hook location of member_customfileds. I then put in Code:
if ($userinfo['field15']) When I put in data for field15 that utilizes http or www or img, etc. that code is not striped from the data so it shows up in that field. |
htmlspecialchars_uni is not a function that strips tags.
Please give examples of input and exactly what you want to strip from that input (i.e. before and after examples). |
Paul:
If somewhere to put in http://www.yourplace.com Go to my place. I want it to have only "Go to my place" (without the quotes) striping out the url. Or if they try to use < img src="http://......." > it would strip out the everything from < to >. Also, I would like to strip out any { } or [ ]. Thanks, Parker |
I don't think there is a single vb function to do all of that - the best way would probably be to use preg_replace() with some custom regex.
|
Paul:
Thanks. I am very much a newbee when it comes to code. Could you write up something that I could see what you are recommending done that I could expand on? Parker |
You need someone who knows regex quite well to use my suggestion, sadly that's not me, it just gives me a bad headache.
|
Would something like this work?
if ($userinfo['field15']) { $userinfo['field15'] = preg_replace('#(?<!<http>|<img>|<www>)#', ' ', $userinfo['field15']); } |
PHP Code:
|
Dismounted:
Still no go. If I put in http://www that is what shows up in the field. If I put in <http that is what shows up. Thanks, Parker |
All times are GMT. The time now is 01:45 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|