<?php 
### Enter your username and password into the connection string: ###

/*
$db_host ="localhost"; //$_POST['db_host'];
		$db_user = "root";//$_POST['db_user'];
		$db_password = "123456";//$_POST['db_password'];
		
$dbLink = mysql_connect($db_host, $db_user , $db_password ) or die("Unable to connect to the database.");
//$sql = "show databases";
//$query = mysql_query($sql) or die("error fetching database names");
//while ($rs=mysql_fetch_array($query)) {
//echo "Database: " . $rs['Database'] . "\n";

$dbname='storesdb - Copy';
mysql_select_db($dbname,$dbLink) or die("Unable to select database: " . $rs['Database']);
$sql = "show tables";
$query2 = mysql_query($sql) or die("error fetching table names");
while ($rs2=mysql_fetch_array($query2)) {
$key = "Tables_in_" . $dbname;
//echo "Table: " . $rs2[$key] . "\n";
$sql = "repair table " . $rs2[$key];
$query3 = mysql_query($sql) or die("Error repairing a table - $sql");
$rs3 = mysql_fetch_array($query3);
echo $rs3['Table'] . " | " . $rs3['Op'] . " | " . $rs3['Msg_type'] . " | " . $rs3['Msg_text'] . "\n";
}
//}
echo "Finished!\n";
*/
/*
for( $z= 1;$z <=100000;$z++)
{
$uni_id = 30;//rand(10,99);
//print_r('uni_id'.$uni_id."<br>");
$first = $uni_id;

$chars_to_do = 7 - strlen($uni_id);
//print_r('chars_to_do'.$chars_to_do."<br>");
for ($i = 1; $i <= $chars_to_do; $i++)
 { 
 	$first .= chr(rand(48,57));
	//print_r('first'.$first."<br>");
  }

echo $first."<br>";

}
/*
$chars_to_do = 5 - strlen($uni_id);
for ($i = 1; $i <= $chars_to_do; $i++) 
{
    if ($i == "2") { $second[] = $uni_id; }
    $second[] = chr(rand(48,57));
}

echo "-" . implode("", $second);

$chars_to_do = 5 - strlen($uni_id);
for ($i = 1; $i <= $chars_to_do; $i++) 
{
    if ($i == "3") { $third[] = $uni_id; }
    $third[] = chr(rand(48,57));
}

echo "-" . implode("", $third);

$chars_to_do = 5 - strlen($uni_id);
for ($i = 1; $i <= $chars_to_do; $i++) 
{
    $fourth[] = chr(rand(48,57));
}
$fourth[] = $uni_id;

echo "-" . implode("", $fourth);
*/

/*for( $z= 1;$z <=100000;$z++)
{
	$i=131112;
	$serial=$i_1
	/*
$chars = array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
$serial = '';
$max = count($chars)-1;
for($i=0;$i<20;$i++){
    $serial .= (!($i % 5) && $i ? '-' : '').$chars[rand(0, $max)];
}*/
/*echo $serial."<br>";
}*/

//echo date('s');


$t=time();
echo($t . "<br>");
echo(date("Y-m-d H:i:s T",$t));

?>
