vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   MySQL query in Template (https://vborg.vbsupport.ru/showthread.php?t=140457)

steadicamop 02-25-2007 08:50 PM

MySQL query in Template
 
Hi all,

I'm in the progress of making a product to stop leeching from attachments (I found a member who hot-linked to three attachments, and was leeching bandwidth) - so I've used the hook system to create a referrer check to check the url is from the forum, if not - show a message.

I'm debating whether it's worth adding a DB query to find out which post the attachment is in - so I can put a link in to it (in a way forcing you to view the forum). My question is :

Can you execute a MySQL query inside a template?

How do I make the code required to associate the clicked attachment link with the post, then output the link for that post?

Hope that makes sense.....

Thanks!

Jason

Princeton 02-25-2007 08:56 PM

- do not allow GUESTS (unregistered) to view/download attachments
- you can prevent hotlinking via htaccess

steadicamop 02-25-2007 08:59 PM

Quote:

Originally Posted by Princeton (Post 1190619)
- do not allow GUESTS (unregistered) to view/download attachments
- you can prevent hotlinking via htaccess

I want guests to be able to view attachments, just not linked on other sites.

I tried the .htaccess version but didn't have much success so have put together a quick plugin that does the trick - and works well.

Cheers

Jason


All times are GMT. The time now is 08:07 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.02409 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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