Skip to content

Instantly share code, notes, and snippets.

@anhducbkhn
Created April 30, 2017 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anhducbkhn/4964a3d9b2a0ef202ee1073f0ec89e10 to your computer and use it in GitHub Desktop.
Save anhducbkhn/4964a3d9b2a0ef202ee1073f0ec89e10 to your computer and use it in GitHub Desktop.
<?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