Advertisement
joserafael22

Untitled

Dec 26th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.08 KB | None | 0 0
  1. <?php
  2.  
  3.     include '../../../../includes/config.php';
  4.  
  5.     $titulo = $_POST['titulo'];
  6.     $descricao = $_POST['descricao'];
  7.     $categoria = $_POST['categoria'];
  8.     $tamanho = $_POST['tamanho'];
  9.     $magnet = $_POST['magnet'];
  10.     $tags = $_POST['tags'];
  11.     $erro = 0;
  12.    
  13.     $tamanho_bytes = $tamanho*1048576;
  14.    
  15.     /*Valida os Campos*/   
  16.     if (empty($descricao))
  17.         {echo"<script type='text/javascript'>";
  18.  
  19.     echo "alert('Atenção, a Descrição não é Válida');";
  20.     echo "javascript:history.go(-1)";
  21.  
  22.     echo "</script>"; $erro=1;}
  23.    
  24.     if (preg_match('#magnet:\?xt=urn:btih:(?<hash>.*?)&dn=(?<filename>.*?)&tr=(?<trackers>.*?)$#', $magnet, $magnet_link)){
  25.        
  26.         $hash = $magnet_link['hash'];
  27.        
  28.         $nomedoarquivo = $magnet_link['filename'];
  29.        
  30.         /*[trackers] => Array
  31.         (
  32.             [0] => udp://tracker.com:80
  33.             [1] => udp://tracker.publicbt.com:80
  34.             [2] => udp://tracker.istole.it:6969
  35.             [3] => udp://tracker.ccc.de:80
  36.             [4] => udp://open.demonii.com:1337
  37.         )
  38.         */
  39.         $magnet_link['trackers'] = explode('&', urldecode(str_replace('tr=','', $magnet_link['trackers'])));
  40.        
  41.         //so to get first tracker
  42.         $magnet_link['trackers'][0];   
  43.  
  44.    
  45.     mysql_query("INSERT INTO torrents (name, description, category_id, size, hash, tags, created_at, updated_at) VALUES ('$nomedoarquivo', '$descricao', '$categoria', '$tamanho_bytes', '$hash', '$tags', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)");
  46.    
  47.     }else{
  48.     echo"<script type='text/javascript'>";
  49.  
  50.     echo "alert('Atenção, o Magnet Link não é Válido');";
  51.     echo "javascript:history.go(-1)";
  52.  
  53.     echo "</script>";
  54.     };
  55. ?>
  56.  
  57. <style>
  58. .form-container {
  59.    border: 1px solid #808080;
  60.    font-family: 'Helvetica Neue',Helvetica,sans-serif;
  61.    text-decoration: none;
  62.    vertical-align: middle;
  63.    min-width:60%;
  64.    padding:20px;
  65.    width:60%;
  66.    margin:0 auto;
  67.    }
  68. .form-field {
  69.    border: 1px solid #787777;
  70.    background: #faf4ed;
  71.    -webkit-border-radius: 4px;
  72.    -moz-border-radius: 4px;
  73.    border-radius: 4px;
  74.    color: #242423;
  75.    -webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(000,000,000,0.7) 0 0px 0px;
  76.    -moz-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(000,000,000,0.7) 0 0px 0px;
  77.    box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(000,000,000,0.7) 0 0px 0px;
  78.    padding:8px;
  79.    margin-bottom:20px;
  80.    width:100%;
  81.    }
  82. .form-field:focus {
  83.    background: #fff;
  84.    color: #666564;
  85.    }
  86. .form-container h2 {
  87.    text-shadow: #ffffff 0 1px 0;
  88.    font-size:18px;
  89.    margin: 0 0 10px 0;
  90.    font-weight:bold;
  91.    text-align:center;
  92.     }
  93. .form-title {
  94.    margin-bottom:10px;
  95.    color: #636266;
  96.    text-shadow: #ffffff 0 1px 0;
  97.    }
  98. .submit-container {
  99.    margin:8px 0;
  100.    text-align:right;
  101.    }
  102. .submit-button {
  103.    border: 1px solid #447314;
  104.    background: #6aa436;
  105.    background: -webkit-gradient(linear, left top, left bottom, from(#8dc059), to(#6aa436));
  106.    background: -webkit-linear-gradient(top, #8dc059, #6aa436);
  107.    background: -moz-linear-gradient(top, #8dc059, #6aa436);
  108.    background: -ms-linear-gradient(top, #8dc059, #6aa436);
  109.    background: -o-linear-gradient(top, #8dc059, #6aa436);
  110.    background-image: -ms-linear-gradient(top, #8dc059 0%, #6aa436 100%);
  111.    -webkit-border-radius: 4px;
  112.    -moz-border-radius: 4px;
  113.    border-radius: 4px;
  114.    -webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
  115.    -moz-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
  116.    box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0;
  117.    text-shadow: #addc7e 0 1px 0;
  118.    color: #ffffff;
  119.    font-family: helvetica, serif;
  120.    padding: 8.5px 18px;
  121.    font-size: 14px;
  122.    text-decoration: none;
  123.    vertical-align: middle;
  124.    }
  125. .submit-button:hover {
  126.    border: 1px solid #447314;
  127.    text-shadow: #31540c 0 1px 0;
  128.    background: #6aa436;
  129.    background: -webkit-gradient(linear, left top, left bottom, from(#8dc059), to(#6aa436));
  130.    background: -webkit-linear-gradient(top, #8dc059, #6aa436);
  131.    background: -moz-linear-gradient(top, #8dc059, #6aa436);
  132.    background: -ms-linear-gradient(top, #8dc059, #6aa436);
  133.    background: -o-linear-gradient(top, #8dc059, #6aa436);
  134.    background-image: -ms-linear-gradient(top, #8dc059 0%, #6aa436 100%);
  135.    color: #fff;
  136.    }
  137. .submit-button:active {
  138.    text-shadow: #31540c 0 1px 0;
  139.    border: 1px solid #447314;
  140.    background: #8dc059;
  141.    background: -webkit-gradient(linear, left top, left bottom, from(#6aa436), to(#6aa436));
  142.    background: -webkit-linear-gradient(top, #6aa436, #8dc059);
  143.    background: -moz-linear-gradient(top, #6aa436, #8dc059);
  144.    background: -ms-linear-gradient(top, #6aa436, #8dc059);
  145.    background: -o-linear-gradient(top, #6aa436, #8dc059);
  146.    background-image: -ms-linear-gradient(top, #6aa436 0%, #8dc059 100%);
  147.    color: #fff;
  148.    }
  149.    a:link, a:visited {
  150.     text-decoration:inherit;
  151.     color:#069;
  152.     }
  153. a:hover {
  154.     text-decoration: underline;
  155.     color: #069;
  156.     }
  157. a:active {
  158.     text-decoration: none
  159.     }
  160. </style>
  161.  
  162. <div class="form-container">
  163. <div class="form-title"><h2>Torrent Enviado Com Sucesso</h2></div>
  164. <div class="form-title">Redirecionando Usuário em 5 segundos</div>
  165. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement