View file wapirate/wml/down.php

File size: 3Kb
<?php 

include("captainsafeconfig.php");

include("captainsafecore.php");

connectdb();

  $sid = $_GET["sid"];

$brws = $_SERVER['HTTP_USER_AGENT'];

$ope = $_SERVER['HTTP_X_OPERAMINI_PHONE'];

$ubr = "$brws $ope";

$uip = getip();

  if((islogged($sid)))

  {

  $id = $_GET["id"];

  $path = mysql_fetch_array(mysql_query("SELECT filename, size FROM download_post WHERE id='".$id."'"));



if($path[1]>0){

  $filename = $path[0];

  $filepath = "xhtml/topics/"; 

  $bytes = $path[1];

$text = $path[0];



$jpg = substr_count($text,"jpg");

$gif = substr_count($text,"gif");

$png = substr_count($text,"png");

$zip = substr_count($text,"zip");

$sis = substr_count($text,"sis");

$jar = substr_count($text,"jar");

$mp3 = substr_count($text,"mp3");

$gp3 = substr_count($text,"3gp");

$nth = substr_count($text,"nth");

$thm = substr_count($text,"thm");

$amr = substr_count($text,"amr");

$sisx = substr_count($text,"sisx");

$mpg = substr_count($text,"mpg");

$wmv = substr_count($text,"wmv");

$mp4 = substr_count($text,"mp4");

$jpeg = substr_count($text,"jpeg");

$mid = substr_count($text,"mid");

$wma = substr_count($text,"wma");

$jad = substr_count($text,"jad");

$avi = substr_count($text,"avi");

$mov = substr_count($text,"mov");

$mpeg = substr_count($text,"mpeg");

$swf = substr_count($text,"swf");



if($jpg>0){

$type = "image/jpg";

//application/jpg

}else if($gif>0){

$type = "image/gif";

}else if($png>0){

$type = "image/png";

}else if($zip>0){

$type = "application/zip";

}else if($sis>0){

$type = "application/vnd.sybian.install";

}else if($jar>0){

$type = "application/java-archive";

}else if($mp3>0){

$type = "audio/mpeg";

}else if($gp3>0){

$type = "application/octet-stream";

}else if($nth>0){

$type = "application/vnd.nok-s40theme";

}else if($thm>0){

$type = "application/vnd.eri.thm";

}else if($amr>0){

$type = "audio/amr";

}else if($sisx>0){

$type = "application/octet-stream";

}else if($mpg>0){

$type = "video/mpeg";

}else if($wmv>0){

$type = "application/octet-stream";

//audio/x-ms-wmv

}else if($mid>0){

$type = "audio/midi";

}else if($jpeg>0){

$type = "image/jpeg";

}else if($swf>0){

$type = "application/x-shockwave-flash";

}else if($avi>0){

$type = "video/x-msvideo";

}else if($jad>0){

$type = "text/vnd.sun.j2me.app-des...";

}else if($mp4>0){

$type = "video/mp4";

}else if($mpeg>0){

$type = "video/mpeg";

}else if($wma>0){

$type = "audio/x-ms-wma";

}else if($mov>0){

$type = "video/quicktime";

}else{

$type = "Unknown";

}



}else{

  $filename = "logo.gif"; 

  $filepath = "/images/"; 

$type = "image/gif";

}

  }else{

  $filename = "home.gif"; 

  $filepath = "/images/"; 

$type = "image/gif";

  }



  $file = $filepath.$filename; 







  header("Content-type: $type"); 



  header("Content-disposition: attachment; filename=\"$filename\""); 

  header("Content-length: $bytes"); 

  @readfile($file); 

  //Code to record the download in database 

?>