最近在做软交换时研究的一个软交换的东东

源代码在线查看: audio.php

软件大小: 3929 K
上传用户: xx87293767
关键词: 软交换
下载地址: 免注册下载 普通下载 VIP

相关代码

												/**				 * @file				 * plays recording file				 */																if (isset($_GET['recording'])) {								  chdir("..");				  include_once("./includes/bootstrap.php");								  global $ARI_CRYPT_PASSWORD;								  $crypt = new Crypt();								  $path = $crypt->decrypt($_GET['recording'],$ARI_CRYPT_PASSWORD);								  // strip ".." from path for security				  $path = preg_replace('/\.\./','',$path);				  				  // See if the file exists				  if (!is_file($path)) { die("404 File not found!"); }								  // Gather relevent info about file				  $size = filesize($path);				  $name = basename($path);				  $extension = strtolower(substr(strrchr($name,"."),1));								  // This will set the Content-Type to the appropriate setting for the file				  $ctype ='';				  switch( $extension ) {				    case "mp3": $ctype="audio/mpeg"; break;				    case "wav": $ctype="audio/x-wav"; break;				    case "Wav": $ctype="audio/x-wav"; break;				    case "WAV": $ctype="audio/x-wav"; break;				    case "gsm": $ctype="audio/x-gsm"; break;								    // not downloadable				    default: die("404 File not found!"); break ;				  }								  // need to check if file is mislabeled or a liar.				  $fp=fopen($path, "rb");				  if ($size && $ctype && $fp) {				    header("Pragma: public");				    header("Expires: 0");				    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");				    header("Cache-Control: public");				    header("Content-Description: wav file");				    header("Content-Type: " . $ctype);				    header("Content-Disposition: attachment; filename=" . $name);				    header("Content-Transfer-Encoding: binary");				    header("Content-length: " . $size);				    fpassthru($fp);				  } 				}								?>			

相关资源