mchiappinam

PasteHTML

Jun 13th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. By: kyle!
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Para alguns que tinham dúvidas de como criar um site igual ao PasteHTML, são simples dois códigos:
  8.  
  9. index.html
  10.  
  11.  
  12.  
  13. Código PHP:
  14.  
  15.  
  16. <html>
  17. <head>
  18. <link rel='stylesheet' href='http://mrrover.ueuo.com/lol.css' type='text/css'>
  19. <title>PasteESBODY</title>
  20. </head>
  21. <body>
  22. <center>
  23. <form method='post' action='./hospeda.php'>
  24. Nome do arquivo: <input type='text' name='nome'>
  25. Seu código: <textarea style='width:500px;height:300px;' class='input' name='codigo'><script>alert('by mchiappinam')</script></textarea><br>
  26. <input type='submit' name='submit' value='Hospedar'>
  27. </form></center>
  28. </body>
  29. </html>
  30. hospeda.php
  31.  
  32.  
  33.  
  34.  
  35. Código PHP:
  36.  
  37.  
  38. <?php
  39. if(isset($_POST['submit'])){
  40. $codigo = $_POST['codigo'];
  41. $nome = $_POST['nome'];
  42. }
  43. else
  44. die("Preencha o formulário");
  45. if(file_exists("arquivos/$nome.html")){
  46. die("Já existe um arquivo com esse nome.");
  47. }
  48. else
  49. $criar = fopen("arquivos/$nome.html", "w") or die("Ocorreu um erro");
  50. fwrite($criar, stripslashes($codigo)) or die("Ocorreu um erro");
  51. fclose($criar) or die("Ocorreu um erro");
  52. ?>
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Para usar é simples, crie uma pasta no seu host com o nome arquivos e então usando seu FTP dê permissões CHMOD777 nesse diretório.
  59. Por fim, é só ir até ao seu Index e enviar seus códigos.
Advertisement
Add Comment
Please, Sign In to add comment