Movable Type Hack: Register to Download
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
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.
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
- Download download.php for Movable Type.
- Edit the file so that $blogId is set to the value of your blog ID.
- Create a directory in the root directory of your published blog named "registered".
- 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 */*
- 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.)
- 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.
- Upload your file to the registered directory using Movable Type 4 asset manager.
- Insert the file into your entry using the "Insert File" button.
- 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".
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.
If you liked this post, share it with others:
Categories
Movable Type0 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






















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