/* check if file is being accessed directly */ //require_once ("lib/functions.php"); require_once ("lib/BDecode.php"); require_once ("lib/BEncode.php"); //dbconn(); if (isset($_FILES["torrent"])) { if ($_FILES["torrent"]["error"] != 4) { $fd = fopen($_FILES["torrent"]["tmp_name"], "rb") or die("File upload error 1\n"); is_uploaded_file($_FILES["torrent"]["tmp_name"]) or die("File upload error 2\n"); $alltorrent = fread($fd, filesize($_FILES["torrent"]["tmp_name"])); $array = BDecode($alltorrent); if (!isset($array)) { echo "Dieses Torrent ist beschädigt!"; exit; } if (!$array) { echo "Dieses Torrent ist beschädigt!"; exit; } $hash = sha1(BEncode($array["info"])); fclose($fd); } if (isset($_POST["filename"])) $filename=StripSlashes(strip_tags($_POST["filename"])); else $filename = StripSlashes($_FILES["torrent"]["name"]); $url = "torrents/" . $hash . ".btf"; if (isset($_POST["info"])) $comment =strip_tags( $_POST["info"]); else $comment = ""; if (isset($_POST["autoset"])) { if (strcmp($_POST["autoset"], "enabled") == 0) { if (strlen($filename) == 0 && isset($array["info"]["name"])) $filename = $array["info"]["name"]; if (isset($array["comment"])) $info = $array["comment"]; else $info = ""; } } $upfile=$array["info"]; if (isset($upfile["length"])) { $size = $upfile["length"]; } else if (isset($upfile["files"])) { // multifiles torrent $size=0; foreach ($upfile["files"] as $file) { $size+=intval($file["length"]); } } else $size = "0"; $filename = strip_tags($filename); $url = strip_tags($url); $info = strip_tags($info); $categoria = 0+$_POST["type"]; $categoria = strip_tags($categoria); $scategoria = 0+$_POST["subtype"]; $scategoria = strip_tags($scategoria); $comment = strip_tags($comment); $tinfo = strip_tags($tinfo); $announce=$array["announce"]; $anonyme=$_POST["hideuser"]; $hash = strip_tags ($hash); if ($categoria==0) { echo "you did not fill in the category"; exit(); } if ((strlen($hash) != 40) || !verifyHash($hash)) { echo("