<?php 
require('includes/settings.php');
require('includes/mysql_connect.php');
require('includes/funcs.php');

for ($i=0; $i < 5000 ; $i++) 
{ 
	$code = strtoupper(substr(md5(uniqid(rand(), true)), 3, 5));
	// check to see if already in db
	$check_sql = "SELECT intBonusCodeID from tblKioskBonusCodesParkPlace2016 where strBonusCode = '$code'";
	$check_result = getFromDatabase($check_sql);
	if (mysqli_num_rows($check_result) == 0)
	{
		$insert_sql = "INSERT into tblKioskBonusCodesParkPlace2016 (strBonusCode) VALUES ('$code')";
		$insert_result = getFromDatabase($insert_sql);
	}
	else
	{
		$i -= 1;
	}
}

for ($i=0; $i < 5000 ; $i++) 
{ 
	$code = strtoupper(substr(md5(uniqid(rand(), true)), 3, 5));
	$code = 'BRI'.$code;
	// check to see if already in db
	$check_sql = "SELECT intBonusCodeID from tblKioskBonusCodesParkPlace2016 where strBonusCode = '$code'";
	$check_result = getFromDatabase($check_sql);
	if (mysqli_num_rows($check_result) == 0)
	{
		$insert_sql = "INSERT into tblKioskBonusCodesParkPlace2016 (strBonusCode) VALUES ('$code')";
		$insert_result = getFromDatabase($insert_sql);
	}
	else
	{
		$i -= 1;
	}
}
?>