View file wap/cut.php

File size: 10.64Kb
<?php
include("inc/func.inc.php");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
  if(!db()){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getdberror();
  echo "</body>";
  echo "</html>";
  exit();
  }

  $show = $_GET["show"];
  $hits = $_GET["hits"];
  $page = $_GET["page"];
  $who = $_GET["who"];
  $uid = getuid_hits($hits);
  $uip = getip();
  $ubr = $_SERVER['HTTP_USER_AGENT'];
  cleardata();
  addvisitor();

  if(isipbanned($uip,$ubr)){
  if(!isshield(getuid_hits($hits))){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getipbanned($uip, $ubr);
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if(($show != "") && ($show != "terms")){
  $uid = getuid_hits($hits);
  if((islogged($hits)==false)||($uid==0)){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getsesexplog();
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if((isbanned($uid))&&($uid != '0')){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getbanned($uid);
  echo "</body>";
  echo "</html>";
  exit();
  }

 if($show=="cut")
{
 require_once "inc/id.inc.php";
 $a = $_GET['file'];
 $want = $_GET['start'];
 $s = $_POST['s'];
 $p = $_POST['p'];
 $way = $_POST['way'];

    addonline(getuid_hits($hits),"Downloads - Cut Mp3","");
        include("inc/css.inc.php");
  ///echo "<card=\"main\" title=\"Downloads - Cut Mp3\">";

 $name = mysql_fetch_array(mysql_query("SELECT filename FROM mx_uploads WHERE id='".$a."'"));
 $ext = getext($name[0]);

 if($ext=="mp3" or $ext=="Mp3" or $ext=="MP3")
 {
 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Mp3 Cutter</b>";
 echo "<div class=\"box_sub\" align=\"center\">";
 if(!isset($want)||empty($want))
 {
  echo "<form action=\"cut.php?show=cut&amp;hits=$hits&amp;file=$file&amp;start=ok\" method=\"post\">";
  echo "Cutting Mode<br/>";
  echo "<select name=\"way\">";
  echo "<option value=\"size\">In kb</option>";
  echo "<option value=\"time\">In seconds</option>";
  echo "</select><br/>";
  echo "Starting From (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"s\" format=\"*N\"/><br/>";
  echo "Finish At (kb sau sec)<br/>";
  echo "<input type=\"text\" name=\"p\" format=\"*N\"/><br/>";
    echo "<input type=\"submit\" value=\"Cut\"/></form>";
 }else{
 $error = 0;
 if($a !="")
 {
 if(!isset($s)||empty($s))
 {
 echo "<b>You haven't choose a value for start!</b><br/><br/>";
 $error = 1;
 }

 if(!isset($p)||empty($p))
{
 echo "<b>You haven't choose a value for end!</b><br/><br/>";
 $error = 1;
 }
 }

 if($error==1)
{

  echo "Cutting Mode<br/>";
  echo "<form action=\"cut.php?show=cut&amp;hits=$hits&amp;file=$file&amp;start=ok\" method=\"post\">";
  echo "<select name=\"way\">";
  echo "<option value=\"size\">In kb</option>";
  echo "<option value=\"time\">In seconds</option>";
  echo "</select><br/>";
  echo "Starting From (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"s\" format=\"*N\"/><br/>";
  echo "Finish At (kb sau sec)<br/>";
  echo "<input type=\"text\" name=\"p\" format=\"*N\"/><br/>";
    echo "<input type=\"submit\" value=\"Cut\"/></form>";

}

if($error==0)
{
 $link = mysql_fetch_array(mysql_query("SELECT filename FROM mx_uploads WHERE id='".$a."'"));
 $ext = getext($link[0]);
 $path = htmlspecialchars("fshare/$ext/$link[0]");

 $randintval = rand(10000000,99999999).".mp3";

 $randintval = htmlspecialchars("$randintval");

 copy($path,$randintval);

 $fp = fopen($randintval, "rb");
 $raz = filesize($randintval);
 $s = intval($s);
 $p = intval($p);
 if($way=="size")
{
 $s = $s*1024;
 $p = $p*1024;

 if($s>$raz||$s<0)
 {
 $s = 0;
 }

 if($p>$raz||$p<$s)
 {
 $p = $raz;
 }
 }else{

 $id3 = new MP3_Id();

 $result = $id3->read($randintval);

 $result = $id3->study();

 $byterate = $id3->getTag('bitrate')/8;

 $secbit = $raz/1024/$byterate;
if($s>$secbit||$s<0)
 {
 $s = 0;
 }

 if($p>$secbit||$p<$s)
 {
 $p = $secbit;
 }

 $s = $s*$byterate*1024;
 $p = $p*$byterate*1024;
 }
 $p = $p-$s;
 fseek($fp, $s);

 $filefp = fread($fp, $p);
 fclose($fp);
 unlink($randintval);

 $fp = fopen($randintval, "xb");
 if(!fwrite($fp, $filefp) === FALSE)
 {
 echo "<b>Your request was successfully processed!</b>";
 echo "<br/><br/>";

 $sz = filesize($randintval);
 if ($sz<1024)
 {
 $sz = "$sz bytes";
 }

 else if (($sz>=1024)&&($sz<1048576))
 {
 $sz = strtr(round($sz/1024,2),".",",")." KB";
 }

 else if ($sz>=1048576)
  {
 $sz = strtr(round($sz/1024/1024,2),".",",")." MB";
 }

 echo "File size: <b>$sz</b><br/>";

 $id2 = new MP3_Id();
 $results = $id2->read($randintval);

 $results = $id2->study();

 echo "Mode: <b>".
$id2->getTag('mode')."</b><br/>";

 echo "Bitrate: <b>".$id2->getTag('bitrate')." KBPS</b><br/>";

 echo "Duration: <b>".$id2->getTag('length')."</b><br/>";

 echo "Frequency: <b>".$id2->getTag('frequency')." HZ</b><br/>";

 echo "<a href=\"$randintval\">Download Now</a>";

}else{

 echo "Unexpected error. Check if the file is a <b>valid</b> mp3 format.";
 }

fclose($fp);
}
}
 
  echo "</div>";
 }else{
 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Mp3 Cutter</b>";
 echo "<div class=\"box_sub\" align=\"center\">";
 echo "Unexpected error. Check if the file is a <b>valid</b> mp3 format.";
 echo "</div>";
 }
   echo "<a href=\"lists.php?show=fview&amp;hits=$hits&amp;file=$a\">";
    echo "Back To File</a><br/>";
    echo "<a href=\"lists.php?show=fshare&amp;hits=$hits\">";
    echo "Download</a><br/>";
    echo "<a href=\"index.php?show=main&amp;hits=$hits\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Home</a></div>";
include("wapv.php");
    echo "</body>";
}
 else if($show=="mp3")
{
 require_once "inc/id.inc.php";
 $a = $_POST['a'];
 $s = $_POST['s'];
 $p = $_POST['p'];
 $way = $_POST['way'];

    addonline(getuid_hits($hits),"Wap Service - Mp3 Cutter","");
        include("inc/css.inc.php");
  ///echo "<card=\"main\" title=\"Wap Services - Mp3 Cutter\">";

 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Mp3 Cutter</b>";
 echo "<div class=\"box_sub\" align=\"center\">";
 if(!isset($a)||empty($a))
 {
  echo "<form action=\"cut.php?show=mp3&amp;hits=$hits\" method=\"post\">";
  echo "Mp3 Url<br/>";
  echo "<input type=\"text\" name=\"a\" value=\"http://\"/><br/>";
  echo "Cutting Mode<br/>";
  echo "<select name=\"way\">";
  echo "<option value=\"size\">In kb</option>";
  echo "<option value=\"time\">In seconds</option>";
  echo "</select><br/>";
  echo "Starting From (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"s\" format=\"*N\"/><br/>";
  echo "Finish At (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"p\" format=\"*N\"/><br/>";
    echo "<input type=\"submit\" value=\"Cut\"/></form>";
 }else{
 $error = 0;
 if($a !="")
 {
 if(!isset($s)||empty($s))
 {
 echo "<b>You haven't choose a value for start!</b><br/><br/>";
 $error = 1;
 }

 if(!isset($p)||empty($p))
{
 echo "<b>You haven't choose a value for end!</b><br/><br/>";
 $error = 1;
 }
 }

 if($error==1)
{
  echo "<form action=\"cut.php?show=mp3&amp;hits=$hits&amp;time=$time\" method=\"post\">";
  echo "Mp3 Url<br/>";
  echo "<input type=\"text\" name=\"a\" value=\"http://\"/><br/>";
  echo "Cutting Mode<br/>";
  echo "<select name=\"way\">";
  echo "<option value=\"size\">In kb</option>";
  echo "<option value=\"time\">In seconds</option>";
  echo "</select><br/>";
  echo "Starting From (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"s\" format=\"*N\"/><br/>";
  echo "Finish At (kb or sec)<br/>";
  echo "<input type=\"text\" name=\"p\" format=\"*N\"/><br/>";
    echo "<input type=\"submit\" value=\"Cut\"/></form>";

}

if($error==0)
{

 $path = htmlspecialchars("$a");

 $randintval = rand(10000000,99999999).".mp3";

 $randintval = htmlspecialchars("$randintval");

 copy($path,$randintval);

 $fp = fopen($randintval, "rb");
 $raz = filesize($randintval);
 $s = intval($s);
 $p = intval($p);
 if($way=="size")
{
 $s = $s*1024;
 $p = $p*1024;

 if($s>$raz||$s<0)
 {
 $s = 0;
 }

 if($p>$raz||$p<$s)
 {
 $p = $raz;
 }
 }else{

 $id3 = new MP3_Id();

 $result = $id3->read($randintval);

 $result = $id3->study();

 $byterate = $id3->getTag('bitrate')/8;

 $secbit = $raz/1024/$byterate;
if($s>$secbit||$s<0)
 {
 $s = 0;
 }

 if($p>$secbit||$p<$s)
 {
 $p = $secbit;
 }

 $s = $s*$byterate*1024;
 $p = $p*$byterate*1024;
 }
 $p = $p-$s;
 fseek($fp, $s);

 $filefp = fread($fp, $p);
 fclose($fp);
 unlink($randintval);

 $fp = fopen($randintval, "xb");
 if(!fwrite($fp, $filefp) === FALSE)
 {
 echo "<b>Your request was successfully processed!</b>";
 echo "<br/>";

 $sz = filesize($randintval);
 if ($sz<1024)
 {
 $sz = "$sz bytes";
 }

 else if (($sz>=1024)&&($sz<1048576))
 {
 $sz = strtr(round($sz/1024,2),".",",")." KB";
 }

 else if ($sz>=1048576)
  {
 $sz = strtr(round($sz/1024/1024,2),".",",")." MB";
 }

 echo "<left>";
 echo "&#8226; File size: <b>$sz</b><br/>";

 $id2 = new MP3_Id();
 $results = $id2->read($randintval);

 $results = $id2->study();

 echo "&#8226; Mode: <b>".
$id2->getTag('mode')."</b><br/>";

 echo "&#8226; Bitrate: <b>".$id2->getTag('bitrate')." KBPS</b><br/>";

 echo "&#8226; Duration: <b>".$id2->getTag('length')."</b><br/>";

 echo "&#8226; Frequency: <b>".$id2->getTag('frequency')." HZ</b><br/>";

 echo "&#8226; <a href=\"$randintval\">Download Now</a>";

}else{

 echo "Unexpected error. Check if the file is a <b>valid</b> mp3 format.";
 }

fclose($fp);
}
}
  echo "</left></div>";
    echo "<a href=\"service.php?show=main&amp;hits=$hits\">";
    echo "Wap Services</a><br/>";
    echo "<a href=\"index.php?show=main&amp;hits=$hits\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Home</a></div>";
include("wapv.php");
    echo "</body>";
}
?>
</html>