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-13-2007 09:23 PM

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

Paul M 08-13-2007 10:14 PM

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.

Parker Clack 08-17-2007 08:17 PM

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

Paul M 08-17-2007 08:51 PM

You need someone who knows regex quite well to use my suggestion, sadly that's not me, it just gives me a bad headache.

Parker Clack 08-17-2007 09:11 PM

Would something like this work?

if ($userinfo['field15'])
{
$userinfo['field15'] = preg_replace('#(?<!<http>|<img>|<www>)#', ' ', $userinfo['field15']);
}

Dismounted 08-18-2007 05:04 AM

PHP Code:

if ($userinfo['field5'])
{
    
$patterns = array(
        
'/<(.*?)>/i',
        
'/{(.*?)}/i',
        
'/[(.*?)]/i'
    
);
    
$userinfo['field5'] = preg_replace($patterns''$userinfo['field5']);


@Paul, regex used to confuse me (and still does) but I get the hang of it :).

Parker Clack 08-19-2007 09:31 PM

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 08:49 PM.

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.01061 seconds
  • Memory Usage 1,727KB
  • 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
  • (1)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
  • (7)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