Aera223

WRITER-TOOL

Sep 15th, 2020 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.43 KB | None | 0 0
  1. <!DOCTYPE html><html lang="en"><title>Admin</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><?php
  2.  
  3. //Prevents password guessing. If the security file is not blank, STOP the script in an obvious way.
  4. if(@file_get_contents('security.tmp')!=""){echo file_get_contents('security.tmp')."</html>"; exit;}
  5.  
  6. //Gets data from a config file
  7. $data = file("wd.txt");
  8. if($data[2]==""){$data[2]="#993300";}if($data[3]==""){$data[3]="#ffff99";}
  9. if($data[0]=="" || $data[1]=="" || $data[2]==""|| $data[3]==""|| $data[4]=="" || crc32($_REQUEST['code'])== $data[4] && $_REQUEST['code']!=""){
  10.  
  11. if($_GET['set']!=3){$data = file("wd.txt");
  12.  
  13. //The setup page
  14.  
  15. echo '<style>html{font-family:corbel; background:'.$data[3].'; color:'.$data[2].';}*{padding:0.2em}</style><h1>Welcome :)</h1><p><br>
  16. <form action="writer.php?set=3" method="post">
  17. This edition includes a security kill switch.
  18. Title:<input name="cn" placeholder="@Nick\'s writer" value="'.str_replace("<br />","",nl2br($data[1])).'"><br>
  19. Text:<input type="color" name="fg" value="'.str_replace("\n","",$data[2]).'"><br>
  20. Page:<input type="color" name="bg" value="'.str_replace("\n","",$data[3]).'"><br>
  21. Secret (to access writer): <input name="ws" required><br><br>
  22. Confirm it: <input name="sc" required><br><input type="submit" value="Save"><br>
  23. Rest assured that the secret is not stored in plaintext.<br>
  24. Then hit enter.</p></form><h3>This simplified software is provided by Aeron<mark>:)</mark>.<br>To protect yourself, I\'ve included a "Cache".</h3>';exit;}
  25.  
  26.  
  27. elseif($_GET['set']==3 && $_REQUEST['sc'] == $_REQUEST['ws']){
  28. $set = fopen("wd.txt", "w");
  29. $txt = time()."
  30. ".$_REQUEST['cn']."
  31. ".$_REQUEST['fg']."
  32. ".$_REQUEST['bg']."
  33. ".crc32($_REQUEST['ws']);
  34. fwrite($set,$txt); fclose($set);}}
  35.  
  36. //Retrieves config
  37. $nick = $data[1];
  38. $fg = $data[2]; $bg = $data[3];
  39. $pass = $data[4];
  40.  
  41. //Send login
  42. if(crc32($_REQUEST['pass'])!=$pass){
  43. echo "<style>body{background:$bg; color:$fg; font-family:corbel;margin:3em;}a{color:$fg}</style><body><h1><mark>🔑</mark> Admin <small>(file editor) <a href='index.php'>... or go Back</small></h1><p><a href='source.php'>🧿 File viewer</a></p>";echo'
  44. <form action="writer.php?auth='.date("H").'" method="post">
  45. Key:<input type="text" name="pass" autofocus style="padding:0.4em;font-size:1.1em;background:#e22;color:#fff;">
  46. <input type="hidden" name="f" value="'.$_GET['f'].'">
  47. <br><br>Final attempt: Tap Enter to login.</form></body>';
  48.  
  49.  
  50. //Security file stuff.
  51. if($_REQUEST['pass']!=""){file_put_contents("security.tmp", 'GUESS: '.date("j @ H:i:s ")).' by '.$_SERVER['HTTP_USER_AGENT'];}
  52. if($_REQUEST['x']!="")file_put_contents("security.tmp","WARN: ".(time()-$_REQUEST['x']));}
  53. else{if($_REQUEST['f']!=""){$fs = filesize($_REQUEST['f']);}
  54.  
  55. //The writing part
  56. if($_REQUEST['f']!="" && $_REQUEST['data']!="")
  57. {$file = $_REQUEST['f'];$data = $_REQUEST['data'];
  58. rename($_REQUEST['f'],"backup.tmp");
  59. if ($data == 'clear'){unlink($_REQUEST['f']);}
  60. else{$w = fopen($file, "w");fwrite($w, $data); fclose($w);}
  61. $t = "Done";}
  62. if($_REQUEST['f']!=""){$fs = filesize($_REQUEST['f']);}
  63. else{$t = "File writer";}
  64.  
  65. //bg 448, fg 9f9
  66. if($_REQUEST['f']!=""){$x = 'style="background:#ff0;padding:0.5em"';}else{$x = 'style="padding:0.5em; autofocus"';}
  67.  
  68. echo '<style>body{background:'.$bg.'; color:'.$fg.'; font-family:calibri}mark,input{background:#bff;font-size:110%}
  69. a{background:'.$fg.'; color:'.$bg.'}mark,code{color:inherit}
  70. pre{white-space:pre-wrap;       /* CSS 2.1+ */
  71.  white-space:-moz-pre-wrap;  /* Mozilla, since 1999 */
  72.  white-space:-o-pre-wrap;    /* Opera 7 */}
  73. .un{color:#fff;}
  74. form{display:inline}
  75. input{font-family:corbel,times new roman;}
  76. </style><title>'.$nick.'</title>
  77. <p class="un"><form action="writer.php" method="post" id="x">
  78. <input type="submit" name="exit" value=" ❎ Sign Out"><a href="backup.tmp">📑Original file</a><a href="source.php?f='.$_REQUEST["f"].'"> 🔮 Safe mode</a></form>
  79.  
  80. <form id="w" action="writer.php" method="post" accept-charset="UTF-8">
  81. <input type="text" class="int" name="f" size="15" placeholder="File name" value="'.$_REQUEST["f"].'" '.$x.'><br><br>';
  82.  
  83. echo'<textarea id="q" form="w" class="int" name="data" width="99%" rows="20" cols="150" placeholder="Contents"></textarea><br>
  84.  
  85. <script>
  86. document.getElementById(\'q\').innerHTML=document.getElementById(\'aa\').innerText;
  87. </script>
  88.  
  89.  
  90. <input type="hidden" name="pass" value="'.$_REQUEST['pass'].'">
  91. <input type="submit" class="int" value=" 🧧 Send"></form><form action="writer.php" method="post" id="x">
  92. <input type="hidden" name="pass" value="'.$_REQUEST['pass'].'">
  93. <input type="submit" value=" ✔ Edit another "></form>
  94.  
  95. <form action="writer.php?f=wd.txt" method="post" id="x">
  96. <input type="hidden" name="pass" value="'.$_REQUEST['pass'].'">
  97. <input type="hidden" name="data" value="clear">
  98. <input type="submit" value=" 🧨 Reset"></form><br><a href="'.$_REQUEST['f'].'" target="blank">'.$_REQUEST['f'].'</a> ('.$fs.')<br><pre style="background:#fff" id="aa">';
  99.  
  100. if ($_REQUEST['f']!=""){
  101. $source = show_source($_REQUEST['f'], true);
  102. $source = str_replace("<br />","",$source);
  103. $source = str_replace("&lt;","<mark>&lt;</mark>",$source);
  104. $source = str_replace("&gt;","<mark>&gt;</mark>",$source);
  105. echo $source;}
  106. else{echo"This will show you the source code, unless the file is an image.<br><br>Type 'clear' to clear the contents of a file.<br><br>The previous copy of a file can typically be accessed by clicking on '📑 Original file'.";}
  107. echo'</pre>';}
  108. ?>
  109.  
Add Comment
Please, Sign In to add comment