| case 'upload': |
| $db->beginTransaction(); |
| $sql = $db->prepare('SELECT * FROM `files` WHERE `id` = ?'); |
| $sql->execute(array($_GET['id'])); |
| $load = $sql->fetch(); |
| $db->commit(); |
| |
| if(empty($load[0])) die ('<div style="text-align:center;">'.$language['1005'].'</div>'); |
| |
| $db->beginTransaction(); |
| $sql = $db->prepare('SELECT * FROM `error` WHERE `file` = ?'); |
| $sql->execute(array($load[1])); |
| $error = $sql->fetch(); |
| $db->commit(); |
| |
| if(!empty($error[0])) die ('<div style="text-align:center;">'.$error[2].'</div>'); |
| if(!empty($load[8])){ unset($_SESSION['protect']); header('Location: /view/'.$load[0].'/'); exit(); } |
| |
| $tmp = './files/tmp/'.$load[1].'.size'; |
| define('TITLE', $language['040']); |
| require_once ('style/head.php'); |
| |
| echo '<div class="contur"><div class="header"><div style="text-align: left">'; |
| if(empty($_GET['provkod'])){ |
| echo '<form action="/get/upload/'.$load[0].'/" method="get"><fieldset style="border: none">'; |
| echo '<img src="/protect.php?'.SID.'" alt="image"/> <a href="/get/upload/'.$load[0].'/">'.$language['041'].'</a><br/><input name="provkod" size="4" maxlength="4" />'; |
| echo '<input type="submit" value="Ok" /></fieldset></form>'; |
| } else if($_GET['provkod'] == $_SESSION['protect']){ |
| if (!file_exists($load[6])) open('GET', '/get/auto/'.$load[0].'/'); |
| echo '<meta http-equiv="refresh" content="10;url=/get/upload/'.$load[0].'/?provkod='.intval($_GET['provkod']).'">'; |
| echo $language['042'].'<strong>'.procent(file_exists($load[6]) ? filesize($load[6]) : 0, file_exists($tmp) ? file_get_contents($tmp) : 1) . '%</strong><br />'; |
| echo $language['043'].'<a href="/get/upload/'.$load[0].'/?provkod='.intval($_GET['provkod']).'&'.rand(0, 10).'">'.$language['044'].'</a><br/>'; |
| echo $language['045']; |
| } else { |
| echo '<div style="color:red">'.$language['1007'].'</div>'; |
| echo '<a href="/get/upload/'.$load[0].'/">'.$language['046'].'</a></div>'; |
| unset($_SESSION['protect']); |
| } |
| echo '</div></div></div>'; |
| break; |
| |
| case 'auto': |
| $db->beginTransaction(); |
| $sql = $db->prepare('SELECT * FROM `files` WHERE `id` = ?'); |
| $sql->execute(array($_GET['id'])); |
| $load = $sql->fetch(); |
| $db->commit(); |
| |
| $protect = curl($load[4], 'http://vkontakte.ru/app'.$setup['app_id']); |
| preg_match('/content-length:\s(\d+)/i', $protect, $match); |
| if(strpos($protect, 'Content-Type: audio/mpeg') === false) { |
| $db->beginTransaction(); |
| $sql = $db->prepare('INSERT INTO `error` (`file`,`text`,`attribut`) VALUES (?,?,?);'); |
| $sql->execute(array($load[1],$language['1006'],'original')); |
| exit(); |
| } |
| |
| $tmp = './files/tmp/'.$load[1].'.size'; |
| if(!file_exists($tmp)) file_put_contents($tmp, $match[1]); |
| if(copy($load[4], $load[6])){ |
| require_once ('incfiles/getid3/getid3.php'); |
| $getID3 = new getID3; |
| $getID3->setOption(array('encoding' => 'cp1251')); |
| $info = $getID3->analyze($load[6]); |
| tags(); |
| $db->beginTransaction(); |
| $sql = $db->prepare('UPDATE `files` SET `server` = ? WHERE `id` = ?'); |
| $sql->execute(array(1,$load[0])); |
| $db->commit(); |
| unlink($tmp); |
| exit(); |
| } else { |
| $db->beginTransaction(); |
| $sql = $db->prepare('INSERT INTO `error` (`file`,`text`,`attribut`) VALUES (?,?,?);'); |
| $sql->execute(array($load[1],$language['1008'],'original')); |
| $db->commit(); |
| exit(); |
| } |
| break; |