Created
April 30, 2017 02:27
-
-
Save anhducbkhn/4964a3d9b2a0ef202ee1073f0ec89e10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$serverName = 'localhost'; | |
$userName = 'root'; | |
$password = 'a'; | |
$dbName = 'test'; | |
$conn = new mysqli($serverName, $userName, $password, $dbName); | |
if ($conn->connect_error) { | |
die ('Connection failed' . $conn->connect_error); | |
} | |
for ($number = 1012; $number < 1015; $number++) { | |
$user = (string)$number; | |
$domain = 'sip.cogilo.com'; | |
$pas = '1012'; | |
$ha1 = md5($number . ':sip.cogilo.com:' . $number); | |
$ha1b = md5($number . '@sip.cogilo.com:sip.cogilo.com:' . $number); | |
$sql = 'INSERT INTO cogilo_test (username, domain, password, ha1, ha1b) VALUES (' . $user . ',"' . $domain . '",' . $pas . ',"' . $ha1 . '","' . $ha1b . '")'; | |
// echo $sql; | |
if ($conn->query($sql) === true) { | |
echo 'Insert new record sucessfully: ' . $number . PHP_EOL; | |
} else { | |
echo 'Error: ' . $number . $conn->error . PHP_EOL; | |
} | |
} | |
$conn->close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment