Advertisement
Guest User

UPDATE MULTIPLE TABLES HAVE users STRING

a guest
Feb 26th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. // UPDATE MULTIPLE TABLES HAVE users STRING
  4. // PDO VERSION
  5. // HASANAL BULKIAH
  6.  
  7.  
  8. include 'config.php';
  9.  
  10.     $list = array();
  11.     $res = $db->query('SHOW TABLES LIKE "%users%"');
  12.     while ($row = $res->fetch(PDO::FETCH_NUM)) {
  13.         $list[] = $row[0];
  14.     }
  15.     $count = count($list);
  16.     foreach ($list as $tables) {
  17.         $username = 'florienzh';
  18.         $password = 'florienzh';
  19.         $editQuery = 'UPDATE '.$tables.' SET user_name=:username, user_pass=:password WHERE id=:id';
  20.         $edit = $db->prepare($editQuery);
  21.         $data = array(
  22.             ':username' => $username,
  23.             ':password' => md5($password),
  24.             ':id' => 1
  25.         );
  26.         if($edit->execute($data)){
  27.             echo "[SUKSES] $tables | $username:$password \n";
  28.         } else {
  29.             echo "[FAILED] $tables | $username:$password \n";
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement