Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $loadedtext = "";
- $files = glob("sablonok/*.php");
- $selected = current($files);
- if (isset($_POST["codearea"]) && isset($_POST["editname"]))
- {
- if (file_exists($_POST["editname"]) && $_POST["changefile"] == 0)
- {
- file_put_contents($_POST["editname"], $_POST["codearea"]);
- $loadedtext = $_POST["codearea"];
- }
- $selected = $_POST["editname"];
- }
- if ($loadedtext == "")
- {
- $loadedtext = file_get_contents($selected);
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta content="text/html; charset=utf-8" http-equiv="content-type" />
- <script type="text/javascript" src="http://ckeditor.com/apps/ckeditor/3.6.2/ckeditor.js"></script>
- </head>
- <body>
- <h3><?php echo basename($selected) ?></h3>
- <form method="post" id="editform">
- <input type="hidden" name="changefile" id="changefile" value="0" />
- <textarea id="codearea" name="codearea"><?php echo $loadedtext?></textarea>
- <input type="submit" value="Mentés" />
- <select name="editname" onchange="document.getElementById('changefile').value=1;document.getElementById('editform').submit()">
- <?php foreach ($files as $filenev): ?>
- <option value="<?php echo $filenev?>" <?php if ($filenev == $selected){echo "selected='selected'";} ?> >
- <?php echo basename($filenev)?>
- </option>
- <?php endforeach?>
- </select>
- </form>
- <script type="text/javascript">
- CKEDITOR.replace( 'codearea' );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment