Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.91 KB | None | 0 0
  1. <?php
  2.  
  3. $hostDb='mysql:host=127.0.0.1;port=3306;dbname=oxwall';
  4. $user='root';
  5. $password='yourmom';
  6.  
  7. $DBH = new PDO($hostDb, $user, $password);
  8.  
  9. $QTH = $DBH -> prepare( "SELECT id,username,password FROM ow_base_user ORDER BY id DESC
  10.  
  11. LIMIT 1");
  12.          $QTH -> execute();
  13.  
  14.          $qea = $QTH -> fetchAll();
  15.  
  16.          //$qqw = $qea ["password"];
  17.          //$qer = $qea ["username"];
  18.  
  19.           $ETH = $DBH -> prepare( "SELECT userId FROM ow_friends_friendship ORDER BY id
  20.  
  21. DESC LIMIT 1");
  22.          $ETH -> execute();
  23.          $aqs = $ETH -> fetch();
  24.  
  25.          $WTH = $DBH -> prepare( "SELECT id FROM ow_base_user ORDER BY id DESC LIMIT 1");
  26.          $WTH -> execute();
  27.          $WTH -> execute();
  28.          $zes = $WTH -> fetch();
  29.  
  30.  
  31.          $huh = $aqs ["userId"];
  32.          $nope = $zes ["id"];
  33.  
  34.          if ( $huh == $nope ) {
  35.          
  36.          echo "done.";
  37.  
  38.          } else {
  39.  
  40.          echo "Adding user";
  41.  
  42.          foreach ($qea as $row) {
  43.  
  44.          $etc = exec("cut -d: -f1 /etc/passwd | grep -x " . chr(34) . $row["username"] .
  45.  
  46. chr(34));
  47.  
  48.           $XTH = $DBH -> prepare( "SELECT id,username FROM ow_base_user WHERE username =
  49.  
  50. :parameter" );
  51.           $XTH->bindParam(':parameter', $row["username"], PDO::PARAM_STR);
  52.           $XTH -> execute();
  53.           $result = $XTH -> fetch();
  54.           $user = $result ["id"];
  55.  
  56.          $HTH = $DBH -> prepare( "SELECT id FROM ow_base_user" );
  57.          $HTH -> execute();
  58.          $zea = $HTH -> fetchAll();
  59.  
  60.          foreach ($zea as $blah) {
  61.  
  62.          $everybody = $blah["id"];
  63.  
  64.          $status = "active";
  65.          $stamp = exec("date +%s");
  66.          $viewed = "1";
  67.          $active = "1";
  68.          $notificationSent = "0";
  69.  
  70.           $ETH = $DBH -> prepare( "SELECT id FROM ow_friends_friendship ORDER BY id LIMIT
  71.  
  72. 1");
  73.          $ETH -> execute();
  74.          $ETH -> execute();
  75.          $aqs = $ETH -> fetch();
  76.  
  77.          $huh = $aqs ["id"];
  78.  
  79.          /* $huh += 1;*/
  80.  
  81.          /*$iUniqueNumber = crc32(uniqid());*/
  82.  
  83.          $my_unique_id = "DEFAULT";
  84.          var_dump($huh);
  85.  
  86.          $ZTH = $DBH -> prepare("INSERT INTO ow_friends_friendship (id, userId, friendId,
  87.  
  88. status, timeStamp, viewed, active, notificationSent)
  89. VALUES (:id, :userId, :friendId, :status, :timeStamp, :viewed, :active, :whatever)");
  90.          $ZTH->bindParam(':id', $my_unique_id, PDO::PARAM_STR);
  91.          $ZTH->bindParam(':userId', $user, PDO::PARAM_STR);
  92.          $ZTH->bindParam(':friendId', $everybody, PDO::PARAM_STR);
  93.          $ZTH->bindParam(':status', $status, PDO::PARAM_STR);
  94.          $ZTH->bindParam(':timeStamp', $stamp, PDO::PARAM_STR);
  95.          $ZTH->bindParam(':viewed', $viewed, PDO::PARAM_STR);
  96.          $ZTH->bindParam(':active', $active, PDO::PARAM_STR);
  97.          $ZTH->bindParam(':whatever', $notificationSent, PDO::PARAM_STR);
  98.          $ZTH -> execute();
  99.          $result = $ZTH -> fetch();
  100.          }
  101.         }
  102.        }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement