Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/12/2010, 23:14
SonrisaCs
 
Fecha de Ingreso: diciembre-2010
Mensajes: 180
Antigüedad: 13 años, 4 meses
Puntos: 5
Respuesta: Crear formulario para subir archivos a mi host

Upload.php
Código PHP:
Ver original
  1. <?php
  2. //  ___  ____       _  ______ _ _        _   _           _  
  3. //  |  \/  (_)     (_) |  ___(_) |      | | | |         | |  
  4. //  | .  . |_ _ __  _  | |_   _| | ___  | |_| | ___  ___| |_
  5. //  | |\/| | | '_ \| | |  _| | | |/ _ \ |  _  |/ _ \/ __| __|
  6. //  | |  | | | | | | | | |   | | |  __/ | | | | (_) \__ \ |_
  7. //  \_|  |_/_|_| |_|_| \_|   |_|_|\___| \_| |_/\___/|___/\__|
  8. //
  9. // by MiniFileHost.co.nr                  version 1.1
  10. ////////////////////////////////////////////////////////
  11.  
  12. include("./config.php");
  13. include("./header.php");
  14.  
  15. $filename = $_FILES['upfile']['name'];
  16. $filesize = $_FILES['upfile']['size'];
  17. $rand2=rand('1','999999');
  18.  
  19. $m=$shourturl;
  20. if ($m=="true")
  21.   $short= "";
  22. else
  23.   $short= "download.php?file=";
  24.  
  25. $bans=file("./bans.txt");
  26. foreach($bans as $line)
  27. {
  28.   if ($line==$rand2."\n"){
  29. ?> <center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top>
  30. <?
  31.     echo "That file is not allowed to be uploaded.";
  32. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  33.     include("./footer.php");
  34.     die();
  35.   }
  36.   if ($line==$_SERVER['REMOTE_ADDR']."\n"){
  37. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top>
  38.    <? echo "You are not allowed to upload files.";
  39. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  40.     include("./footer.php");
  41.     die();
  42.   }
  43. }
  44.  
  45. $checkfiles=file("./files.txt");
  46. foreach($checkfiles as $line)
  47. {
  48.   $thisline = explode('|', $line);
  49.   if ($thisline[0]==$filecrc){
  50.     $filecrc=rand('10000','1000000000');
  51.   }
  52. }
  53.  
  54. if(isset($allowedtypes)){
  55. $allowed = 0;
  56. foreach($allowedtypes as $ext) {
  57.   if(substr($filename, (0 - (strlen($ext)+1) )) == ".".$ext)
  58.     $allowed = 1;
  59. }
  60. if($allowed==0) {
  61. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top><?
  62.    echo "That file type is not allowed to be uploaded.";
  63.    ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  64. include("./footer.php");
  65.    die();
  66. }
  67. }
  68.  
  69. if(isset($categorylist)){
  70. $validcat = 0;
  71. foreach($categories as $cat) {
  72.   if($_POST['category']==$cat || $_POST['category'] = ""){ $validcat = 1; }
  73. }
  74. if($validcat==0) {
  75. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top><?
  76.    echo "Invalid category was chosen..";
  77. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  78.    include("./footer.php");
  79.    die();
  80. }
  81. $cat = $_POST['category'];
  82. } else { $cat = ""; }
  83.  
  84. if($filesize==0) {
  85. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top><?
  86. echo "You didn't pick a file to upload.";
  87. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  88. include("./footer.php");
  89. die();
  90. }
  91.  
  92. $filesize = $filesize / 1048576;
  93.  
  94. if($filesize > $maxfilesize) {
  95. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top><?
  96. echo "The file you uploaded is too large.";
  97. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  98. include("./footer.php");
  99. die();
  100. }
  101.  
  102. $userip = $_SERVER['REMOTE_ADDR'];
  103. $time = time();
  104.  
  105. if($filesize > $nolimitsize) {
  106.  
  107. $uploaders = fopen("./uploaders.txt","r+");
  108. flock($uploaders,2);
  109. while (!feof($uploaders)) {
  110. $user[] = chop(fgets($uploaders,65536));
  111. }
  112. fseek($uploaders,0,SEEK_SET);
  113. ftruncate($uploaders,0);
  114. foreach ($user as $line) {
  115. @list($savedip,$savedtime) = explode("|",$line);
  116. if ($savedip == $userip) {
  117. if ($time < $savedtime + ($uploadtimelimit*60)) {
  118. ?><center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top><?
  119. echo "You're trying to upload again too soon!";
  120. ?></center></td></tr></table><p style="margin:3px;text-align:center"><?
  121. include("./footer.php");
  122. die();
  123. }
  124. }
  125. if ($time < $savedtime + ($uploadtimelimit*60)) {
  126.   fputs($uploaders,"$savedip|$savedtime\n");
  127. }
  128. }
  129. fputs($uploaders,"$userip|$time\n");
  130.  
  131. }
  132.  
  133. $passkey = rand(100000, 999999);
  134.  
  135. if($emailoption && isset($_POST['myemail']) && $_POST['myemail']!="") {
  136. $uploadmsg = "Your file (".$filename.") was uploaded.\n Your download link is: ". $scripturl . "$short" . $rand2 . "\n Your delete link is: ". $scripturl . "$short" . $rand2 . "&del=" . $passkey . "\n Thank you for using our service!";
  137. mail($_POST['myemail'],"Your Uploaded File",$uploadmsg,"From: [email protected]\n");
  138. }
  139.  
  140. if($passwordoption && isset($_POST['pprotect'])) {
  141.   $passwerd = md5($_POST['pprotect']);
  142. } else { $passwerd = md5(""); }
  143.  
  144. if($descriptionoption && isset($_POST['descr'])) {
  145.   $description = strip_tags($_POST['descr']);
  146. } else { $description = ""; }
  147.  
  148. $filelist = fopen("./files/".$rand2.".txt","w");
  149. fwrite($filelist, $rand2 ."|". basename($_FILES['upfile']['name']) ."|". $passkey ."|". $userip ."|". $time."|0|".$description."|".$passwerd."|".$cat."|\n");
  150.  
  151. $movefile = "files/$rand2/$filename";
  152. move_uploaded_file($_FILES['upfile'], $movefile);
  153. ?>
  154. <center><table style="margin-top:20px;width:790px;height:400px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top>
  155.  
  156. <?
  157. include("./ads.php");
  158. echo "<center><b>Tu archivo fue subido!</b></center><br/>";
  159. echo "<center>Link de descarga:</center><p><center><a href=$scripturl/files/$rand2/$filename>$scripturl/files/$rand2/$filename</a><br/>";
  160. echo "<p><center>Link de eliminación:</center><p><center><a href=$scripturl/files/$rand2/&del=$filename>$scripturl/files/$rand2/&del=$filename</a><br />";
  161. echo "<p><center>Please remember the above links."; ?><p><?
  162. include("./bottomads.php");
  163. ?>
  164.   </td></tr></table></center>
  165.  
  166. <hr>
  167. <p align="center">If you want, we will send an e-mail to up to three persons, who will be informed   about your upload. This e-mail will only contain your download links. The delete   links will not be mentioned. For privacy reasons, the e-mail addresses will not   be saved.
  168. <form action="http://rs365.rapidshare.com/cgi-bin/sendmail.cgi" method="post" target="_blank">
  169.   <div align="center">
  170.     <table>
  171.       <tr><td><div align="center"><b>Your name (as signer):</b></div></td><td>  <input type="text" name="name" size="32">
  172.       </td></tr>
  173.       <tr><td><b>E-Mail #1:</b></td><td><input type="text" name="email1" size="32"></td></tr>
  174.       <tr><td><b>E-Mail #2:</b></td><td><input type="text" name="email2" size="32"></td></tr>
  175.       <tr><td><b>E-Mail #3:</b></td><td><input type="text" name="email3" size="32"></td></tr>
  176.     </table>
  177.     <input type="submit" value="Send download links to the e-mail addresses above">
  178.   </div>
  179. </form></p>
  180. <hr>
  181. <p align="center">Last but not least you can create a free collector´s account now. Your advantages:
  182.  
  183.  
  184. <table><tr><td><div align="center">
  185.   <ul>
  186.     <li>Collect premium-points for downloads of your files and then convert them to a <b>FREE PREMIUM-ACCOUNT!</b></li>
  187.     <li>Use remote HTTP/FTP-Uploads to do server-to-server transfers.</li>
  188.     <li>Manage your files easily and add files to your collection at anytime.</li>
  189.     <li>Especially for photos, thumbnails are generated for an easy overview of your photos.</li>
  190.     <li>No more need to write down links or waiting until uploads are completed. Your uploads will automatically be added to your collection.</li>
  191.   </ul>
  192. </div></td></tr></table>
  193. </p>
  194. <p align="center">Create your free account now. Its easy! Just enter the details below.<br>Your uploaded file will automatically be added to your new collection.</p>
  195. <p align="center"><b>IMPORTANTE:</b> This is NO premium-account, but a collector´s account.<br>
  196. This means that you will not have any premium-download privileges.</p>
  197. <p><form action="https://ssl.rapidshare.com/cgi-bin/freeaccount.cgi" method="post" target="_blank">
  198.   <div align="center">
  199.     <table>
  200.       <tr>
  201.         <td><b>Usuario:</b></td>
  202.         <td><input type="text" name="username" size="32"></td></tr>
  203.       <tr><td><b>E-Mail:</b></td><td><input type="text" name="email" size="32"></td></tr>
  204.       <tr><td><b>Password:</b></td><td><input type="password" name="password1" size="16"></td></tr>
  205.       <tr>
  206.         <td><b>Repetir:</b></td>
  207.         <td><input type="password" name="password2" size="16"></td></tr>
  208.     </table>
  209.     <input type="submit" value="Crear cuenta!">
  210.   </div>
  211. </form></p></div></div></div>
  212. </div>
  213. <p>
  214.   <!-- wrapper -->
  215. </p>
  216. </body></html>

Quiero que guarde los archivos en "$scripturl/files/$rand2/"

Ayuda porfavor xD

Cita:
Iniciado por marcofbb Ver Mensaje
Tu servicio de hosting acepta .htaccess ? parece que no ...

Aca tenes otros uploads:
[url]http://www.entra-ya.com.ar/upload-anti-bot-clon-xooimage/[/url]
[url]http://www.entra-ya.com.ar/upload-de-imagenes/[/url]
Si, me pareeeeece que si, ahora voy a ver esos host, muchas gracias