Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Does anyone know of a perl script or something similar that I can upload to my server which will allow me to see what files are being linked. I have 100's of midi files and graphics that I believe other people is linking to causing my bandwidth to be high. I would like to know what files are being linked to so I can change the file names and cause whoever is linking to those files to have broken links on their website (that would teach them to steel my files). Please help.

I'm not sure about Perl (I believe SN is the expert on this)... I used to play with it, but have since replaced it with PHP for the most part?
Do you run your own web server, ie: Apache / IIS? If so, you can require passwords / accounts, etc for viewing. If the MIDI files are meant for the public, you can just through them in another directory... just don't have the main filenames displayed on your site and disable the view-source and right click options... you should be able to reduce the remote-linking but not emilinate it, because there are ways around both of those methods.
IR

Thanks for the plug IR...But I'm more of a perl "afficionado" than an expert. I'm better than average at the OOP side of perl, and pretty good at regular expressions, but I don't know many of the little features that perl programmers live and breathe. I've officially began learning PHP and am quite enjoying it. I particularly like its way of handling form data, although it seems unnatural for variables to just magically appear like that.
Anyhow, back to the matter at hand...The only way I can think of seeing which files are being linked to is by having perl or any other language parse your logs and see which files are being downloaded from which referrers. This is a more complex task than this forum permits, so a search for perl apache log parse on google should do nicely.
I thought password protecting a directory was the most simple and effective idea. You could even make it a public password posted on your site as to not inconvenience "legitimate" users. Then, once they log in, you could redirect them to your home page instead of the file, and they would have to navigate your site to find the file and download it...lots of options to do exactly what you need.
A third option would be to rename the directory every day, and have a perl script that opens each of your web pages and changes the HTML accordingly (or better yet, use SSI for the pages and you'll only have to change one file per day.)
If you need any more info on any of the above options, give a holler.
-SN

"unnatural for variables to just magically appear like that..."
You just have to love PHP, because of that. ;) If not that, then you have to because it is closely related to C++.
My PHP development has been reduced, because my employer requests me to focus on VC++ and VB .NET as well as C# for the next few projects in line. However, for web based content, I always turn to PHP :)
IR
IR

Google has a search feature that allows you to enter a url plus a switch of some kind and it displays either the number of links to it or shows all links that point to it. Not sure wich, or how to do it. I only did it once after I saw it in print somewhere.
Wait, I just found it for ya:

Forget about creating your own log analyzer. There are many available (even in Perl, if you really want to learn a few things). The hardest part of your task (if CPAN or a like resource does not supply) is to take the functionality out a site statistics package and format it for your own uses.
But this is not the best way. Fozzie has a good idea and I would pursue that. Otherwise, simply hide your actual filenames (as so many PHP sites are in the habit of doing) and instead make them queries to a database. In the database, have the actual file or a link to the file. But, before the request passes through the database, examine its origin through the HTTP header data (for example, PHP has $_SERVER('HTTP_REFERER')). If the origin is from anything but your domain or IP, redirect it to a page with the link in question. That way, people from the outside get to your page, but still have one step farther to the link. Also, through this method you can very easily detect the top 10-100 sites that are linking directly to your files. You can then email the webmasters personally with the logs to prove it.
In fact, were you looking for a quick fix, simply redirect any incoming request for a file in a certain folder or with a certain extension (you can be creative in your selection to suit your needs) from another IP to a page with the URL they requested as a link. Same result - no database.

![]() |
webpage disclaimer
|
Java SDK
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |