Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_startup_errors', 1);
- ini_set('display_errors', 1);
- error_reporting(-1);
- $conn = new PDO("sqlsrv:Server=database.windows.net;Database=breach;ConnectionPooling=0", $username, $passwd);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $allInserts = "";
- $block =1024*1024;//1MB or counld be any higher than HDD block_size*2
- if ($fh = fopen("file.txt", "r")) {
- $left='';
- while (!feof($fh)) {// read the file
- $temp = fread($fh, $block);
- $fgetslines = explode("\n",$temp);
- $fgetslines[0]=$left.$fgetslines[0];
- if(!feof($fh) )$left = array_pop($lines);
- foreach ($fgetslines as $k => $line) {
- $acc = explode(':',$line, 2);
- $allInserts = $allInserts . "; INSERT dbo.[USER] ([email], [pass]) VALUES ('".$acc[0]."','".$acc[1]."')";
- }
- }
- }
- fclose($fh);
- try {
- $sql = $allInserts;
- var_dump($sql);exit;
- $result = $conn->prepare($sql);
- $result->execute();
- $results = $result->fetchAll(PDO::FETCH_BOTH);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement