Filtru link php
Scris: Lun Feb 21, 2011
As vrea sa adaug la acest script un filtru, daca apesi pe butonul download si nu ai bagat nimic in form sa zica ca trebuia sa bagi un link , daca bagi alt link si nu unu dupa trilulilu sa zica "link incorect" sper ca intelegeti la ce ma refer
Cod: Selectaţi tot
<?php
//----------------------------------------------------------------------------
// WhiteShadow
if(!isset($_GET['actiune'])) $actiune=false; else $actiune="descarca";
switch($actiune){
default:
?>
<?php
break;
case 'descarca':
$link = explode("/",htmlspecialchars($_POST['link']));
// End WhiteShadow
//----------------------------------------------------------------------------
function getMuzica($str1, $str2)
{
$str3 = floor(strlen($str2)/2);
$lenstr2 = strlen($str2);
$str2pas2 = substr($str2, 0, $str3);
$str2pas3 = substr($str2, $str3, $lenstr2);
$str4 = $str2pas2 . $str1 . $str2pas3;
return md5($str4);
}
$user = $link[3];
$hash = $link[4];
$title ="Trilulilu - Track.mp3";
$key = getMuzica($user, $hash);
$url='http://embed.trilulilu.ro/mp3/'.$user.'/'.$hash.'/?t='.$key;
$nume=html_entity_decode($title);
header("Content-type: audio/mpeg3");
header('Content-Disposition: attachment;filename="'.$nume.'"');
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
set_time_limit(0);
readfile($url);
//----------------------------------------------------------------------------
// WhiteShadow
break;
}
// End WhiteShadow
//----------------------------------------------------------------------------
?>