Log in

View Full Version : MySQL query in Template


steadicamop
02-25-2007, 08:50 PM
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
- 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