Aera223

writer.php

May 11th, 2020
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.95 KB | None | 0 0
  1. <!DOCTYPE html><html>
  2. <?php
  3. #Customise this with your nick and (SHA1) hashed pass. I've left my writer's
  4. $nick = "@Aera23's area";
  5. $pass = "_INSERT_SHA1_HASHED_PASSWORD_";
  6.  
  7.  
  8.  
  9. #Advanced chunk prepares background and foreground colours
  10. $hex=['0','2','4','6','8','a','c','e','f'];
  11. $ca=rand(1,4);$cb=rand(1,4);$cc=rand(1,4);
  12. $ba=rand(5,8);$bb=rand(5,8);$bc=rand(5,8);
  13. #$total = ($ca + $cb + $cc) - ($ba + $bb + $bc);
  14. $bg = '#'.$hex[$ba].$hex[$bb].$hex[$bc];$fg = '#'.$hex[$ca].$hex[$cb].$hex[$cc];
  15.  
  16.  
  17. #Send login. You can change the SHA1 hash function.
  18. if(sha1($_POST['pass'])!=$pass){
  19. echo "<style>input{padding:0.1em; font-size:1.1em}body{background:$bg; color:$fg; font-family:corbel;font-size:1.4vw;padding:0.4em}a{color:$fg}</style><body><h2>$nick<mark>:)</mark></h2>
  20. ".'
  21. <form action="writer.php" method="post">
  22. Code: <input type="password" name="pass" value="4" autofocus>
  23. <input type="hidden" name="f" value="'.$_GET['f'].'"><br><br>';
  24. if($_POST['pass']!=""){echo 'Incorrect code.';}
  25. echo '</form>';}
  26.  
  27. else{
  28. #The writing part
  29. if($_REQUEST['f']!="" && $_POST['data']!="")
  30. {$file = $_POST['f'];$data = $_POST['data'];
  31. if($data == 'clear'){$data = "";}
  32. $w = fopen($file, "w");fwrite($w, $data); fclose($w);$t = "Done";}
  33. else{$t = "File writer";}
  34.  
  35. echo '<style>body{background:'.$bg.'; color:'.$fg.'; font-family:calibri;font-size:1.2vw;padding:0.2em}mark,input,textarea{background:#cff}
  36. a{background:#fff; color:'.$bg.'}
  37. mark,code{color:inherit}
  38. pre{white-space:pre-wrap; /* CSS 2.1+ */ white-space:-moz-pre-wrap;  /* Mozilla, since 1999 */}
  39. input{padding:0.1em; font-size:1.1em}
  40. </style><title>'.$nick.'</title>
  41. <form id="w" action="writer.php?f='.$_POST["f"].'" method="post" accept-charset="UTF-8">
  42. <input type="text" class="int" name="f" size="15" placeholder="File name" value="'.$_POST["f"].'"><br><br>';
  43.  
  44. $fs = filesize($_REQUEST['f']);
  45. echo'<textarea form="w" id="html" class="int" name="data" width="200%" rows="20" cols="150" placeholder="Contents"></textarea><br>
  46. <input type="hidden" name="pass" value="'.$_POST['pass'].'"><br>
  47. <input type="submit" class="int" value="Send" accesskey="s"><br>';
  48.  
  49. #Outputs an image of the filesize. You can remove it if you don't have GD extension
  50. $im=imagecreatetruecolor(200, 22);$bg=imagecolorallocate($im, 0, 60, 0);
  51. $fg=imagecolorallocate($im, rand(128,255), rand(128,255), rand(128,255));
  52. imagefill($im, 0, 0, $bg);imagestring($im, 4, 5, 5, $_REQUEST['f'].'; '.$fs.' bytes', $fg);
  53. echo '<a href="'.$_REQUEST['f'].'"><img width="200" height="22" src="data:image/png;base64,';    
  54. ob_start();imagepng($im);imagedestroy($im);echo base64_encode(ob_get_clean()).'" alt="'.$fs.'"></a>
  55. <br><br></form><pre style="background:#fff" id="aa">';
  56.  
  57. if($_REQUEST['f']!="")
  58. {$source = show_source($_REQUEST['f'], true);
  59. $source = str_replace("<br />","",$source);
  60. $source = str_replace("&lt;","<mark>&lt;</mark>",$source);
  61. $source = str_replace("&gt;","<mark>&gt;</mark>",$source);
  62. echo $source;}
  63.  
  64. echo'</pre>';}
  65. ?>
  66. </html>
Add Comment
Please, Sign In to add comment