Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: gladdos
- * Date: 21.03.2019
- * Time: 21:15
- */
- echo <<<HTML
- <form enctype="multipart/form-data" action="test.php" method="post">
- <input type="text" name="msg" placeholder="Текст">
- <input type="hidden" name="MAX_FILE_SIZE" value="4096" />
- <input type="file" name="key">
- <input type="submit" id="">
- </form>
- HTML;
- $server_private_key = file_get_contents('./private.asc', TRUE, NULL, 0, 512);
- $uploaddir = "C:\\xampp\\htdocs\\php_files\\";
- if ($_FILES['key']['type'] != "text/plain") {
- echo "Выгружаемый файл не явл. тесктом!";
- die;
- }
- $uploadfile = $uploaddir . basename($_FILES['key']['name']);
- echo '<pre>';
- if (move_uploaded_file($_FILES['key']['tmp_name'], $uploadfile)) {
- echo "Файл корректен и был успешно загружен.\n";
- } else {
- echo "Файл не был выгружен!\n";
- }
- print "</pre>";
- $msg = htmlspecialchars($_POST['msg']);
- $user_public_key = file_get_contents($uploaddir . $_FILES['key']['name'], FALSE, NULL, 0, 512);
- function obfuscate($msg, $key)
- {
- if (empty($key)) return $msg;
- return $msg ^ str_pad('', strlen($msg), $key);
- }
- printf(obfuscate($msg, $user_public_key));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement