Movable Type Hack: Register to Download

| | Comments (1) | TrackBacks (0)
Categories:
Imagine that you've provided some content for download that you'll provide for free, but you want to know where it's going and who is downloading it. Or, you may want to draw traffic to your web site by preventing others from hosting the content and thus gain the attention. You can find out who might have downloaded the content by requiring user registration, which will also indicate to other would-be hosts that they shouldn't host the files.

Arvin Satyanarayan

It doesn't have to be difficult, though. In fact, it took me just about an hour to write a simple "hack" consisting of a file that you upload to your published blog. The "register to download" hack verifies that the user is logged in before providing access to a specified file.

Requirements: Movable Type 4.

Installation

  1. Download download.php for Movable Type.
  2. Edit the file so that $blogId is set to the value of your blog ID.
  3. Create a directory in the root directory of your published blog named "registered".
  4. Create a .htaccess file in the newly created directory that prevents users from accessing the directory. For example, the .htaccess file may look like this:
<Files .htaccess>
  order allow,deny
  deny from all
</Files>

order allow,deny
deny from all

IndexIgnore */*

  1. Upload download.php to the root directory of your published blog. (Actually, any web accessible place on your server that hosts the files for download will do, but probably somewhere in your published blog is easiest.)
  2. Optional: you can edit download.php to refer to a directory that is not web-accessible and thus avoid the use of a .htaccess file to prevent access to the directory, or to refer to a directory that isn't placed in the root folder of your published blog. Have a look at the comments in download.php which explain what must be changed.
Usage

  1. Upload your file to the registered directory using Movable Type 4 asset manager.
  2. Insert the file into your entry using the "Insert File" button.
  3. Change to a HTML view of your entry, and modify the <a href="..."> reference to the file so that instead of referring to ".../registered/filename", it refers to ".../download.php?f=filename".
Known Issues: download.php is developed for a Unix system. I've no idea how it will work on a Windows server.

Note: to use this hack for Movable Type, you must place a link to this blog page on your own blog on all pages where download.php is used to require user registration for download.

Please use the comments for support or questions.
  • Currently 3/5
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 3/5 (1 votes cast)

If you liked this post, share it with others:
  • Digg it!
  • Add to Del.Icio.Us
  • Add to Technorati
  • Stumble It!
  • NewsVine
  • Slashdot
  • Google Bookmarks
  • YahooMyWeb
  • Live
  • Facebook
  • Facebook
  • Add this post to Ma.gnolia
  • Add this post to Reddit
  • Thoof it

Categories

0 TrackBacks

Listed below are links to blogs that reference this entry: Movable Type Hack: Register to Download.

TrackBack URL for this entry: http://blog.blazingangles.net/MT/mt-tb.cgi/60

1 Comments

sudhakar_mgks2a said:

i am a web developer , now i start to doing moveable type4 ,

please help me to implenent the following in the moveable type

user registration
two-level commenting
site wide search
email an entry to a friend
sign up for email updates

Leave a comment

Sign In

About This Entry

This page contains a single entry by Ole Wolf published on September 17, 2007 6:58 AM.

Previous entry: Linux Applications Replacing Windows.

Next entry: Survival Tips: Lessons in Misanthropy.

Find recent content on the main index or look in the archives to find all content.

Subscribe to Comments

Creative Commons License
This weblog is licensed under a Creative Commons License.