Author Archive

How To : Prevent Songs Download (Part-II)

March 28th, 2010

In the first post I showed how to setup basic audio player and play a song and left with this important part to show how we can secure our songs and prevent downloads. So lets see how we can make it most secured so that maximum users failed to download or get a direct access to the download link. After writing this, I will hope to hear from you, if there are any better ways we can make a song secured. Please discuss freely, hopefully, it will help others who are seeking same information.

To me best solution is, you have 2 types of songs of same song. One type contains only 30/40 seconds and you let them play on browser and if people want to buy then ask them to use user id and password to get full song access. But if you don’t want to go in that way, follow me here

Main Concept: Let’s not understand the users where they are downloading or where they are playing the song from. I mean lets hide the download location! And then let’s stop direct access to the folder location.

Lets say you have directory name /music where you are keeping all the songs. We will hide this location and will stop the direct access. First of all rename the folder where you are keeping all these secret weapons. (I.e : eTsscXXzwolF) and then create a htaccess file in that directory and put the following codes

Options -Indexes
<files *>
order allow,deny
deny from all
</files>

after placing this code in the directory, you will see you can’t get a direct access to the location via browser. So we have protected the direct access but we haven’t hides the directory yet. So let’s do it now…i have got this nice script that hide the location and let you download the file. I don’t need to allow people to download file but I need the location hider. So i modified this script for my needs.

//filename: hide.php
// Usage: <a href="hide.php?file=playlist.xml">How to use</a>
// Path to hide files (will not be revealed to users so they will never know your file's real address) 
$hiddenPath = "xrrcOXX/";
// VARIABLES 
if (!empty($_GET['file'])) {
    $file = str_replace('%20', ' ', $_GET['file']);
    $category = (!empty($_GET['category'])) ? $_GET['category'] . '/' : '';
} 
$file_real = $hiddenPath . $category . $file; 
$ip = $_SERVER['REMOTE_ADDR']; 
// Check to see if the hide script was called 
if (basename($_SERVER['PHP_SELF']) == 'hide.php') {
    if ($_SERVER['QUERY_STRING'] != null) {
// HACK ATTEMPT CHECK 
// Make sure the request isn't escaping to another directory 
//if (substr($file, 0, 1) == '.' ¦¦ strpos($file, '..') > 0 ¦¦ substr($file, 0, 1) == '/' ¦¦ strpos($file, '/') > 0)  { 
        if ((substr($file, 0, 1) == '.') || (strpos($file, '..') > 0) || (substr($file, 0, 1) == '/') || (strpos($file, '/') > 0)) {
// Display hack attempt error 
            echo("Hack attempt detected!");
//die(); 
        }
// If requested file exists 
        if (file_exists($file_real)) {
            $header_file = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1) : $file;
// Prepare headers 
            header("Pragma: public");
            header("Expires: 0");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Cache-Control: public", false);
            header("Accept-Ranges: bytes");
            header("Content-Transfer-Encoding: binary");
            header("Content-Length: " . filesize($file_real));
            if ($stream = fopen($file_real, 'rb')) {
                while(!feof($stream) && connection_status() == 0) {
                    set_time_limit(0);
                    print(fread($stream,1024*8));
                    flush();
                }
                fclose($stream);
            }
        }else {
       // Requested file does not exist (File not found) 
            echo("Requested file does not exist");
            die();
        }
    }
}

and now let’s call our previous example to see how we can use it ….

<h3>I Need You</h3>
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='300' height='24' id='player1' name='player1'>
    <param name='movie' value='player.swf'>
    </param><param name='allowfullscreen' value='true'>
    </param><param name='allowscriptaccess' value='always'>
    </param><param name='playlistsize' value='180'>
    </param><param name='flashvars' value='hide.php?file=vol11.mp3&duration=231'>
    <embed id='player1'
           name='player1'
           src='player/player-viral.swf'
           width='300'
           height='24'
           allowscriptaccess='always'
           allowfullscreen='true'
           flashvars="file=hide.php?file=vol11.mp3&duration=231"
           />
</param></object>

Now these songs are more secured than before and if you try to access from the link you get by firebug, it wont work instead you will get a blank page download. You can try it yourself ;) and let me know if you have any questions.

How To : Simple Audio Streaming [Part-I]

March 26th, 2010

Starting the post with a well known verse “Your Songs Belong to Us”. Sounds funny but this is really true that you can’t hide your songs on the web. Your all songs that you put in your server, literally you also put on other computers . Because an advance user know how to download your songs/videos. You may use RTMP protocol or HTTP protocol for streaming and you may spend extra money to get a media server such as FMS, Wowza etc but it will hurt you that still you can’t save your songs from the web soldiers. What this RTMP connection does is, it can protect you from maximum users, because maximum general users will not get a direct link of download location of your songs. My question is, if I spend extra money , time and still can’t protect my songs from all users then what’s the point to spend extra money? Rather how about if we set it up such way so that I still can protect my songs that media server allows me to and I dont have to spend extra money and time?

Let’s say you have song albums, you don’t want let users to download your songs but listen to them and you want to pretend direct download from 95% users…i’m gonna discuss how we can do it. This part will describe the basic setup and how we can play a song on the web. So first part is going to be pretty simple but second part will be most interesting and important part.

No extra requirement needed! You have an apache server that will work. So let’s set it up….and well, we need a media player like JW Player. It’s free for no-commercial purpose. So we will use the free version for our example. Let’s download the free version and you have setup wizard to make your life easy. Once you have the player you can use the following example codes that has 2 tags for each song/playlist.

<script type='text/javascript' src='player/swfobject.js'></script>
<h3>I Need You</h3>
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='300' height='24' id='player1' name='player1'>
    <param name='movie' value='player.swf'>
    </param><param name='allowfullscreen' value='true'>
    </param><param name='allowscriptaccess' value='always'>
    </param><param name='playlistsize' value='180'>
    </param><param name='flashvars' value='player/player-viral.swf'>
    <embed id='player1'
           name='player1'
           src='player/player-viral.swf'
           width='300'
           height='24'
           allowscriptaccess='always'
           allowfullscreen='true'
           flashvars="file=playlist.xml&playlist=bottom&playlistsize=180"
           />
</param></object>

You may wonder why I have 2 tags and for the same playlist. Well, IE doesn’t understand embed tag and Firefox, Safari, Chrome don’t understand object tag. Funny eh…this is why, we have to keep the both tags to run them in all browsers. Ok, now let’s create the xml file that will work as our playlist. Here is a sample list xml file

<rss version="2.0" 
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats">
    <channel>
        <title>Example media RSS playlist</title>
        <item>
            <title>MP3 Audio</title>
            <link>http://www.test.com/</link>
            <description>I miss you..</description>
            <media :content duration="44" />
            <media :credit role="author">Mr. X</media>
            <media :content url="you.mp3" />
            <media :thumbnail url="images/test.JPG" />
        </item>
 
        <item>
            <title>MP3 Audio</title>
            <link>http://www.test.com/</link>
            <description>Oye Oye..</description>
            <media :content duration="44" />
            <media :credit role="author">Mr. Y</media>
            <media :content url="you.mp3" />
            <media :thumbnail url="images/test.JPG" />
        </item>
        <item>
            <title>MP3 Audio</title>
            <link>http://www.test.com/</link>
            <description>I need you..</description>
            <media :content duration="44" />
            <media :credit role="author">Mr. X</media>
            <media :content url="test.mp3" />
            <media :thumbnail url="images/test.JPG" />
        </item>
    </channel>
</rss>

Now, simply just run the page where you placed your player code. And you will see something like the following screenshot.

 

Example Play List

Example Play List

  

Make sure you have songs in the same directory or the path you gave in the xml file. This is where we are done with basic setup songs list. But you see anybody can download it from xml list by finding the url. So we are left with main important part of this tutorial. Which I will do in the next part. Will discuss how we can make this list of songs secured so that most of the users face trouble to get it. Stay tune…

Buzz Is Already Successful!

February 15th, 2010

I’m surely going against lots of tech pundits and social media experts by saying this…let me take a long breadth..phew!

You may disagree, and you can definitely debate here. I will put my thoughts here why I think buzz is already successful.

First of all, if you are using buzz you might noticed that you see some people on your list, not idle but sharing some stuff and most of them not even on your twitter/friendfeed or facebook followers list. Interestingly, most of them don’t use twitter/friendfeed even facebook but they are using buzz right? But you know them very well, don’t you? Well, in my case I have noticed around 60% people don’t even have twitter or friendfeed accounts. Interesting eh….So what’s happening here, buzz is bringing new people in this (technically) social world as well as twitter/facebook/friendfeed friends. It’s allowing you to be more public with people you know already. Automatically, I had around 60+ people followed and followed back and I noticed buzz didn’t make any mistake to choose them for my followers list. To me this is one of the biggest success for buzz that it’s bringing new people for me in social world and letting me know what they are up to…

 

 

Buzz - not just status message

Buzz - not just status message

 

 

Now think, people who are using this social tools for the first time, is there any chance they will start switching to twitter and never use buzz again? I don’t think so…so these new users are an asset for buzz, How many users will be like that out of tens of (approximately) millions of gmail users? Even if it’s 25% new social network users come out of it that will be huge thing for buzz. That means buzz is already starting it’s journey with a huge users base.

I have been stopped using friendfeed since the day I got buzz enabled in my gmail, why? Because buzz got the same features with improved ideas and easy sharing facilities. And people I follow on friendfeed are already on my twitter friends list, so I didn’t lose anything there…don’t you think there will be more users from friendfeed to buzz like me? I have already seen lots of people switching to buzz from friendfeed.

Buzz allows you to make your post public or private, though as an user you didn’t have much control over privacy at the beginning but buzz updated their status on privacy and gave more control to users’ hand. Certainly, this going to bring more users to buzz.

It’s certainly not twitter, its better than twitter! You can share almost everything on buzz which you can’t do on twitter. So these need will make users to use buzz, no? And why not when you want to share the things from google itself?

It’s in the browser! You don’t have to start another application or you don’t have to open another tab on your browser to use it. You don’t even have to sign in to use it…isn’t it cool? No worries about what platform you are using….i know Desktop client like Seesmic and TweetDeck will integrate buzz soon but buzz web client itself is already a good one, no doubt about it.

You have inbox integration, you can email any content to anyone like you use gmail with the same interface. You can read all comments in your gmail and reply them from right there…cool eh…

Last but not the list, it’s Google dude. There will be less chance to see buzz is down like twitter ;)

I know I’m just talking about all these positive things of buzz, well that’s all I think and I know there are some negative things of buzz as well. Like if we think it as a twitter, then we will see some features are missing. We will see how buzz comes up with their updates in near future. But to me, buzz is already successful. What do you think? Let me hear you…

A *Failed* Journey Without Mobile And Money

January 30th, 2010

As I planned to spend 7 days without mobile and money, literally failed to maintain it. I was truly determined and well I still think it’s very much possible. Something went wrong and emergencies come first right. So I gave up…coming to how I gave up but let me tell you how I started. As I said in my previous blog that I would write down everyday how I spent the day eh…following was my first day and I couldn’t manage time to write on 2nd day and well failed on 3rd day…

Jan 26 01:13 AM : Today was my first day of “without mobile and money” life. I walked to my office and came back home same way. Had a feelings that I could do it everyday without taking any rickshaw and walking in the morning was nice but again after getting home I realized my laptop had much weight that I didn’t notice before. That’s it, I didn’t face any problem on first day…

That was my first day writing. On second day I started feeling pressure for cellphone. I was receiving emails from my friend, ex-colleagues to open the cell or why my cell was off. I kept replaying that im always online so please email me for any kind of need. Some of them came online and talked to me…so it worked somehow…

BUT, main problem occurred on 3rd day evening when I received an email from my younger brother like “grandmother is in comma, they have been calling you….” I wasn’t prepared for that at all. My mobile was locked at home and I didn’t even have any body’s number memorized. Most stupid thing happened when I asked my wife Tamanna (online) for my mom’s number so that at least I could call. I know im a moron…i can’t even memorize my mom’s number!

So ran to my home here in Uttara and turned ON my cell and talked to my mom first to know about the situation. Plan was to leave dhaka right away for Sunamganj if she was still in comma. Then I talked to my cousins and them in my dada bari to know everything in details. Thank god she was better than the night before….

And, when I turned ON my cell I found lots of miss called alerts and few of them were called more than 15 times. I realized how people suffered for this and how that was important as they had to call more than 15 times! Whoa…realized that im more dependent on cell phone than money…i didn’t have any problem for that at all. I loved walking to office and hopefully from now on I will walk to my office everyday.

But one thing I asked myself, how urban people lived away from their families when there weren’t any cellphones, laptop, email etc and their grandmother was in comma?

Hmm…we must be thankful to these electronics devices, certainly it’s making our life easier (and complex too).

Anyways, am I gonna try to experiment it again? Yes i’m! I cannot fail and I know its very much possible. By the way, I have also noticed how my friends think I can’t live without INTERNET! So that will be my second challenge for sure….

Thank you!

Is It Possible To Spend 7 Days Without Money And Mobile?

January 23rd, 2010

I can remember I did similar thing in 3rd year of my university. Kept myself in my house for 10 days without going out. It was possible because that time I had semester break and instead of going to my hometown Sylhet I stayed in Dhaka. I used to write every night how I spent my day. Unfortunately, I lost those notes as I didn’t blog that time. Feeling like to do similar weird thing again for 7 days and this time I want to stay away from Moble and Money!

I’m going to write every night how I spent the day without money and mobile and what difficulties I faced. And then finally I will post all those notes in my blog here after finishing 7 days. Starting this weird journey from 25th January, Monday. So keep your eyes on this blog, you can expect all those notes here on 1st February :)

So what difficulties I might face?
My family in Sylhet whos around 450kms away from me, my wife whos around 11,000kms (flight distance) away from me. I have already got my wife’s support yay! And im gonna talk to my mom, hopefully she won’t get freaked out he he, and without money? Hopefully it won’t be a big deal as I can walk to my office from my home…

Why I want to do it?
Getting off from all these dependencies of life! Recalling all our old people who lived their life without all these and preparing myself for bigger adventure in near future.

By the way, if I can do it successfully, my next target will be to spend 7 days without laptop! This gonna be most difficult for sure…

So let’s start it from next Monday :)

Get Adobe Flash playerPlugin by wpburn.com wordpress themes