daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Sep 26th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if (isset($_GET['source']) && isset($_GET['dest'])) {
  3.     $sourceb = mysql_real_escape_string($_GET['source']);
  4.     $destb = mysql_real_escape_string($_GET['dest']);
  5.     $folderarray = array('src,thumb');
  6.     foreach($folderarray as $folder) {
  7.         $myDirectory = opendir("/home/opchan/operatorchan.org/".$sourceb."/".$folder);
  8.         while($entryName = readdir($myDirectory)) {
  9.             $dirArray[] = $entryName;
  10.         }
  11.         closedir($myDirectory);
  12.         $pattern = '/^'.$destb .'[0-9]+_.+/is';
  13.         foreach($dirArray as $thisfile) {
  14.             if(preg_match($pattern, $thisfile) != 0) {
  15.             rename("/home/opchan/operatorchan.org/".$sourceb."/".$folder ."/".$thisfile, "/home/opchan/operatorchan.org/".$destb ."/".$folder ."/".$thisfile);
  16.             echo('renamed '. $folder .'/'.$thisfile .'<br>');
  17.             }
  18.         }
  19.     }
  20.     echo('done');
  21. } else {
  22. echo('<form action="" method="get">
  23.     <input name="source" type="text">source board<br>
  24.     <input name="dest" type="text">destination board<br>
  25.     <input type="submit" value="Demerge Board Files">
  26. </form>');
  27. }
  28. ?>
RAW Paste Data
Top