<commit_before><?php
function getDB() {
	$dbHost = 'localhost';
	$db     = 'jordantu_csgowinbig';
	$dbUser = "jordantu_ztizzle";

	# Get database password from outside of web root
	$fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../../passwords.txt';
	if (file_exists($fileLoc)) {
		$fh = fopen($fileLoc, 'r');
		$jsonStr = fgets($fh);
		$arr = json_decode($jsonStr, true);
		$dbPass = $arr['default-password'];
		fclose($fh);
	} else {
		die('no file found');
	}

	$db = new PDO("mysql:host=$dbHost;dbname=$db;charset=utf8", $dbUser, $dbPass);
	return $db;
}

function getSteamProfileInfoForSteamID($allUsersInfoStr, $steamIDToFind) {
	$allUsersInfo = json_decode($allUsersInfoStr, true);
	$players = $allUsersInfo['response']['players'];
	
	foreach ($players as $player) {
		$steamID = $player['steamid'];
		
		if ($steamIDToFind === $steamID) {
			return $player;
		}
	}

	# If the user is not found, then return false
	return false;
}

function jsonSuccess($data) {
	return json_encode(array('success' => 1, 'data' => $data));
}

function jsonErr($errMsg) {
	return json_encode(array('success' => 0, 'errMsg' => $errMsg));
}

function getSteamAPIKey($type) {
	switch ($type) {
		case 'login':
			return '1FBC1D48247E517DB7CE37C093450807'; # Key for testbotztizzle

		case 'chat':
			return '<KEY>'; # Key for jturley128

		case 'pot':
			return ''; # Add this later once I start working on the items, once the chat is working.
		
		default:
			return null;
	}
}
?><commit_msg>Moved steam API keys outside of web root for protection<commit_after><?php
function getDB() {
	$dbHost = 'localhost';
	$db     = 'jordantu_csgowinbig';
	$dbUser = "jordantu_ztizzle";

	# Get database password from outside of web root
	$fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../../passwords.txt';
	if (file_exists($fileLoc)) {
		$fh = fopen($fileLoc, 'r');
		$jsonStr = fgets($fh);
		$arr = json_decode($jsonStr, true);
		$dbPass = $arr['<PASSWORD>'];
		fclose($fh);
	} else {
		die('no file found');
	}

	$db = new PDO("mysql:host=$dbHost;dbname=$db;charset=utf8", $dbUser, $dbPass);
	return $db;
}

function getSteamProfileInfoForSteamID($allUsersInfoStr, $steamIDToFind) {
	$allUsersInfo = json_decode($allUsersInfoStr, true);
	$players = $allUsersInfo['response']['players'];
	
	foreach ($players as $player) {
		$steamID = $player['steamid'];
		
		if ($steamIDToFind === $steamID) {
			return $player;
		}
	}

	# If the user is not found, then return false
	return false;
}

function jsonSuccess($data) {
	return json_encode(array('success' => 1, 'data' => $data));
}

function jsonErr($errMsg) {
	return json_encode(array('success' => 0, 'errMsg' => $errMsg));
}

function getSteamAPIKey($type) {
	$fileLoc = $_SERVER['DOCUMENT_ROOT'] . '/../../passwords.txt';
	if (file_exists($fileLoc)) {
		$fh = fopen($fileLoc, 'r');
		$jsonStr = fgets($fh);
		$arr = json_decode($jsonStr, true);

		switch ($type) {
			case 'login':
				return $arr['steamLoginAPIKey']; # Key for testbotztizzle

			case 'chat':
				return $arr['steamChatAPIKey']; # Key for jturley128

			case 'pot':
				return $arr['steamPotAPIKey']; # Add this later once I start working on the items, once the chat is working.

			default:
				return null;
		}

		fclose($fh);
	} else {
		die('no file found');
	}

	
}
?>
{'fraction_non_alphanumeric': 0.17208588957055215, 'fraction_numerical': 0.010429447852760737, 'mean_word_length': 4.435, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1735166', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1187, 'n_words': 282}