Jayd Saucedo


Direct Linking to Scripts
There are certain websites that link directly to some of my scripts. I'm not going to point any fingers. You know who you are!

There are several problems I have with this. The first and least selfish problem is that I often have multiple versions of the same script uploaded and these websites can't be expected to update every time I update. I don't want people downloading old versions, but I keep them online anyway just in case someone prefers to use them (yes, there are those people). The problem with using old versions is that people are experiencing all of the bugs I've already fixed and they're missing out on all the features that I added! I have gotten many a e-mail questioning bugs that I have already fixed.

The second more selfish problem with this is that these websites often fail to give me any sort of credit. Sure, they will hotlink directly from me but they can't even bother mentioning my name! One of the main reasons I release free scripts is to direct people into my website so they can then consider hiring me. It's an effective method and It has worked! But when there are websites that try to skip the middleman it ends up hurting me!

So how did I thwart the hot linkers? Many would assume that I just disabled the ability to direct link from these websites, but many would be wrong! The reason I don't want to do that is because it would be wasting valuable visitors. What I want to do is make the direct link to the script file redirect to my post about that file!

I accomplished this with about 10 lines of code:

if($ext == "zip" || $ext == "rar"){
		if($ref_site != "saurdo.com"){
			$r_find_related_post = mysql_query("SELECT *  FROM posts WHERE post_content LIKE '%".$reqfile."%' LIMIT 1");
			if(mysql_num_rows($r_find_related_post) > 0){
				$rel_row = mysql_fetch_array($r_find_related_post); 
				header("LOCATION: http://www.saurdo.com/".date('m/d', strtotime($rel_row['post_date']))."/".$rel_row['post_name']."/");
			$allowed = true;

These ten lines are an extension of my "what is a robot" hotlink protection program that I made a while ago. What does the script do? Well, first it detects if the thing you're requesting is a zip or a rar. Downloading either of those filetypes from that particular directory would indicate that you're trying to download some sort of script. Then the script makes sure that it's a foreign site that's requesting the file, and then it searches the database for any posts relating to that file. It's final task is to redirect to the post that relates to that file. If it doesn't find a post it'll present you with the robot page.

That oughta show 'em.