Posted By

daisuke103 on 03/26/09


Tagged

php image textmate delete unlink


Versions (?)

PHP ディレクトリの画像を削除する


 / Published in: Other
 

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <title>BTMX IMAGES</title>
  5. </head>
  6. <body>
  7. <?php $pass = 'btmx' ?>
  8.  
  9. <?php if ($_GET['delete']): ?>
  10. <?php if ($_GET['passwd'] == $pass): ?>
  11. <?php if (unlink($_GET['file'])): ?>
  12. <div style="color:white;background:red"><?php echo $_GET['file'] ?> DELETED.</div><br />
  13. <?php endif ?>
  14. <?php endif ?>
  15. <?php if ($_GET['passwd'] && $_GET['passwd'] != $pass): ?>
  16. <div style="color:white;background:red">INVALID PASSWORD</div><br />
  17. <?php endif ?>
  18.  
  19. <form action="./index.php" method="get" accept-charset="utf-8">
  20. <input type="hidden" name="delete" value="true" id="delete">
  21. <input type="hidden" name="file" value="<?php echo $_GET['file'] ?>" id="file">
  22. <p>pass:<input type="password" name="passwd" value="" id="passwd"></p>
  23. <p><input type="submit" value="Continue &rarr;"></p>
  24. </form>
  25. DELETE THIS↓ ?<hr />
  26. <img src="<?php echo $_GET['file'] ?>"/><br/><br/>
  27. <a href="./index.php">戻る</a>
  28. <hr />
  29.  
  30.  
  31.  
  32.  
  33. <?php endif ?>
  34.  
  35. <?php if ($handle = opendir('./')): ?>
  36. <?php while (false !== ($file = readdir($handle))): ?>
  37. <?php if (strpos($file, '.jpg') !== false || strpos($file, '.png') !== false || strpos($file, '.gif') !== false): ?>
  38. <img src="<?php echo $file ?>" /><br />
  39. <?php echo $file ?> → <a href="./index.php?delete=true&file=<?php echo $file ?>">[DELETE]</a><br />
  40. <br />
  41. <?php endif ?>
  42.  
  43. <?php endwhile ?>
  44. <?php endif ?>
  45. </body>
  46. </html>

Report this snippet  

You need to login to post a comment.