Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_startup_errors', 1);
  4. ini_set('display_errors', 1);
  5. error_reporting(-1);
  6.  
  7. $conn = new PDO("sqlsrv:Server=database.windows.net;Database=breach;ConnectionPooling=0", $username, $passwd);
  8. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9.  
  10. $allInserts = "";
  11.  
  12. $block =1024*1024;//1MB or counld be any higher than HDD block_size*2
  13. if ($fh = fopen("file.txt", "r")) {
  14. $left='';
  15. while (!feof($fh)) {// read the file
  16. $temp = fread($fh, $block);
  17. $fgetslines = explode("\n",$temp);
  18. $fgetslines[0]=$left.$fgetslines[0];
  19. if(!feof($fh) )$left = array_pop($lines);
  20. foreach ($fgetslines as $k => $line) {
  21. $acc = explode(':',$line, 2);
  22. $allInserts = $allInserts . "; INSERT dbo.[USER] ([email], [pass]) VALUES ('".$acc[0]."','".$acc[1]."')";
  23. }
  24. }
  25. }
  26. fclose($fh);
  27.  
  28. try {
  29. $sql = $allInserts;
  30. var_dump($sql);exit;
  31. $result = $conn->prepare($sql);
  32. $result->execute();
  33. $results = $result->fetchAll(PDO::FETCH_BOTH);
  34. } catch (Exception $e) {
  35. var_dump($e->getMessage());
  36. }
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement