vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP: Detect URL in "text". (https://vborg.vbsupport.ru/showthread.php?t=82562)

Harlequin 06-06-2005 02:40 AM

PHP: Detect URL in "text".
 
So here I am again asking for something that seems simple to me, but for one reason or another I can't visualize how to put this on paper.. so to speak.

User inputs in a form:

HTML Code:

<HTML>
<HEAD>
</HEAD>
<BODY>
Hello, check this iframe:
<IFRAME SRC="http://www.someaddress.com"></IFRAME>
</BODY>
</HTML>

When this is output, this can be fine and dandy (for -my- purpose).. if the source URL of the iframe is controlled to a minimal number of possibilities.

So, to work around this, I've came up with the following solution, but I'm not sure how implement it in PHP:

If the user inputs the above in a form.. upon submission, the <IFRAME SRC="" URL would be detected and/or changed to whatever URL I've predetermined (so users can access material only on one site URL, not every site URL).

So, in the above example, if you were to replace the above IFRAME statement with what is below:

User would input:

HTML Code:

<HTML>
<HEAD>
</HEAD>
<BODY>
Hello, check this iframe:
<IFRAME SRC="http://www.badaddress.com">
</BODY>
</HTML>

Script would output:

HTML Code:

<HTML>
<HEAD>
</HEAD>
<BODY>
Hello, check this iframe:
<IFRAME SRC="http://www.goodaddress.com">
</BODY>
</HTML>

Or, for that matter, the script could just give an error and be done with it, too. Either way works for this purpose.

Whatever a user puts in for the URL of the iframe source is dynamic -- there's no set address that is a good address.

Suggestions?


All times are GMT. The time now is 10:52 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.01017 seconds
  • Memory Usage 1,709KB
  • 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_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete