Current location: Hot Scripts Forums » General Community » Script Requests » PHP file location obscuring script


PHP file location obscuring script

Reply
  #1 (permalink)  
Old 05-30-09, 08:41 AM
edbarton edbarton is offline
New Member
 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
PHP file location obscuring script

Hi guys,

Ive got a fairly simple request but it's fairly specific so I'm having a bit of trouble finding what's out there. Currently I have a plugin that creates audio players next to mp3 links. The players being next to them however means I still have a link to the mp3, which is not ideal at all.

What I'm after basically is a script that retains the .mp3 at the end and a specific reference but prevents people from downloading it by clicking on that link. Is this even possible? Possible maybe by restricting requests by page but if the audio is being requested on the page as well and still needs to play, surely you can't prevent people from downloading.

Anyway, if there's something out there, then that'd be great. If I'm barking up the wrong tree and need to find another script to play the mp3 in the first place then tell me.

Thanks in advance,
Ed
Reply With Quote
  #2 (permalink)  
Old 01-13-10, 07:56 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
I know this post is getting old but wondering if this idea would work.

Place you MP3 files in a folder on ur webserver and use a deny all in a htaccess file which will stop people from direct access to your mp3s.

Then create a php file as ur container for the MP3's

for example

getMP3.php?mp3=myMP3
PHP Code:

<?php

$mp3 
$_GET['mp3'];
session_start();

// Some PHP code that checks the MP3 actually exists
if(file_exists("MYMP3s/".$mp3."")) {
  
// Does a session exists for this mp3?
  
if($_SESSION['mp3'] == $mp3) {
    
$content get_file_contents("MYMP3s/".$mp3."");
    
header('Content-Type: audio/mp3');
    echo 
$content;
  }
// MP3 exists
}

unset(
$_SESSION);
?>
So on your mp3 player page u setup a session that holds the mp3 that the user wants to play. When the player hits the php file to load the mp3 it checks the session and if its there it passes the mp3 over. once its passed over the mp3 the session is removed and that mp3 cannot be played or linked to again unless the player is reloaded and the session is generated.

The above is just sample code to get the ideas going. the code may not be correct. I can see some ways around this method to get to the mp3s but it would slow me down as a user. I dont think there is any definate way of stopping your mp3s from being downloaded without being played through the actual mp3 player.
Reply With Quote
Reply

Bookmarks

Tags
downloader, mp3


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 6 03-16-09 07:15 AM
PHP script that knows to read csv file ELV1I2 Script Requests 5 08-05-07 03:19 AM
php upload file script xavier039 PHP 5 08-29-06 04:35 PM
Trying to recode my php script into c to run on linux... DaJackal C/C++ 1 02-03-06 08:22 PM
Run PHP Script Within PHP Script Reg PHP 1 06-29-04 09:09 AM


All times are GMT -5. The time now is 09:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.