vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need some help with code (https://vborg.vbsupport.ru/showthread.php?t=154290)

Parker Clack 08-04-2007 01:05 PM

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")
    {
    $profilefield['value'] = $strip_tags($userinfo["$profilefieldname"]);
    }

Thanks for any help in advance.

Parker

EnIgMa1234 08-04-2007 01:09 PM

Why not just use

Code:

if($userinfo['field15'])
    {
    $userinfo['field15'] = strip_tags($userinfo['field15']);
    }


Parker Clack 08-07-2007 01:54 PM

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

Opserty 08-07-2007 02:52 PM

Techinally they aren't HTML so there is no predefined function for doing this, but you may be able to try this:
PHP Code:

if($userinfo['field5'])
{
    
$badterms = array( 'http''www''img''src');
    
$userinfo['field5'] = str_replace($badterms''$userinfo['field5']);


That should work untested though.

EnIgMa1234 08-07-2007 03:51 PM

Try the htmlspecialchars_uni() tag

Dismounted 08-08-2007 06:12 AM

PHP Code:

if ($userinfo['field5'])
{
    
$userinfo['field5'] = htmlspecialchars_uni($userinfo['field5']);



Parker Clack 08-08-2007 02:06 PM

Sorry but neither examples used strip the html or www or img, etc. from
the feild.

Thanks,

Parker

EnIgMa1234 08-08-2007 02:41 PM

Do you mind posting the whole code? Are you using it exactly like Dismounted

Parker Clack 08-12-2007 09:43 PM

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'])
{
    $userinfo['field15'] = htmlspecialchars_uni($userinfo['field15']);
}

The field ID is 15 instead of 5.

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.

Paul M 08-12-2007 09:52 PM

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).


All times are GMT. The time now is 12:05 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
  • Page Generation 0.01113 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete