<commit_before><?
if(isset($_POST['submit'])){
	if(isset($_POST['newUName']) && isset($_POST['newPass']) && $isset($_POST['newFName'])){ // Entered new user's credentials

		if(isset($_POST['adminUName']) && $isset($_POST['adminPass'])){ // Entered admin credentials
			if(verifyAdmin($_POST['adminUName'],$_POST['adminPass'])){ // Admin Credentials Correct
				include "./mysql.conf.php";
				
				$newUName = $_POST['newUName'];
				$newPass = $_POST['newPass'];
				$encPass = base64_encode($newPass);
				$hashedPass = md5($newPass);
				$newFName = $_POST['newFName'];


				$insertQuery = "INSERT INTO `users` (`username`, `password`, `friendlyName`) VALUES ('$newUName', '$hashedPass', '$newFName')";
				$result = mysqli_query($insertQuery);
				if(mysqli_affected_rows($result) == 1){ // succeeded creating a user
					echo "Successfully created user.";
					addMenu();
				}
				else{ // Bad username or password
					echo "Something happened during user creation.<br/>";
					echo mysqli_error($link);
					echo "<br/>Please try again<br/>";
					addMenu();
				}
			}
			else { // Incorrect Admin Credentials
				echo "Admin Credentials Incorrect<br/>";
				echo "<br/>Please try again<br/>";
				addMenu();
			}
		}
		else { // No Admin Credentials entered.
			echo "You must enter an admin's username and password to create a user<br/>";
			echo "Please try again<br/>";
			addMenu();
		}
	}
}
else { // didn't enter ANY credentials.
	addMenu();
}

function addMenu(){
	echo <<<HTML
<form name="addUser" action="./makeuser.php" method="post">
Login Name: <input type="text" name="newUName" /><br/>
Password: <input type="password" name="newPass" /><br/>
Friendly Name: <input type="text" name="newFName"><br/><br/>

Admin Username : <input type="text" name="adminUName"><br/>
Admin Password : <input type="password" name="<PASSWORD>"><br/>
<button type="submit" name="submit" value="submit">Create User</button>
</form>

HTML;
}

function verifyAdmin($aUser, $aPassword){
	include "./mysql.conf.php";

	$aPassword = base64_encode($aPassword);
	$aPassword = md5($aPassword);
	$buildVerQuer = "SELECT * FROM `users` WHERE `username` , `password` = '$aUser' , '$aPassword' ";
	$buildResult = mysqli_query($link, $buildVerQuer);
	$row = mysqli_fetch_array($buildResult);

	$isadmin = $buildResult['admin'];

	return $isadmin;
}<commit_msg>Misc Bug Fix<commit_after><?
if(isset($_POST['submit'])){
	if(isset($_POST['newUName']) && isset($_POST['newPass']) && $isset($_POST['newFName'])){ // Entered new user's credentials

		if(isset($_POST['adminUName']) && $isset($_POST['adminPass'])){ // Entered admin credentials
			if(verifyAdmin($_POST['adminUName'],$_POST['adminPass'])){ // Admin Credentials Correct
				include "./mysql.conf.php";
				
				$newUName = $_POST['newUName'];
				$newPass = $_POST['newPass'];
				$encPass = base64_encode($newPass);
				$hashedPass = <PASSWORD>($newPass);
				$newFName = $_POST['newFName'];


				$insertQuery = "INSERT INTO `users` (`username`, `password`, `friendlyName`) VALUES ('$newUName', '$hashedPass', '$newFName')";
				$result = mysqli_query($insertQuery);
				if(mysqli_affected_rows($result) == 1){ // succeeded creating a user
					echo "Successfully created user.";
					addMenu();
				}
				else{ // Bad username or password
					echo "Something happened during user creation.<br/>";
					echo mysqli_error($link);
					echo "<br/>Please try again<br/>";
					addMenu();
				}
			}
			else { // Incorrect Admin Credentials
				echo "Admin Credentials Incorrect<br/>";
				echo "<br/>Please try again<br/>";
				addMenu();
			}
		}
		else { // No Admin Credentials entered.
			echo "You must enter an admin's username and password to create a user<br/>";
			echo "Please try again<br/>";
			addMenu();
		}
	}
}
else { // didn't enter ANY credentials.
	addMenu();
}

function addMenu(){
	echo <<<HTML
<form name="addUser" action="./makeuser.php" method="post">
Login Name: <input type="text" name="newUName" /><br/>
Password: <input type="password" name="<PASSWORD>" /><br/>
Friendly Name: <input type="text" name="newFName"><br/><br/>

Admin Username : <input type="text" name="adminUName"><br/>
Admin Password : <input type="password" name="adminPass"><br/>
<button type="submit" name="submit" value="submit">Create User</button>
</form>

HTML;

}

function verifyAdmin($aUser, $aPassword){
	include "./mysql.conf.php";

	$aPassword = base64_encode($aPassword);
	$aPassword = <PASSWORD>($aPassword);
	$buildVerQuer = "SELECT * FROM `users` WHERE `username` , `password` = '$<PASSWORD>' , '$<PASSWORD>' ";
	$buildResult = mysqli_query($link, $buildVerQuer);
	$row = mysqli_fetch_array($buildResult);

	$isadmin = $buildResult['admin'];

	return $isadmin;
}
{'fraction_non_alphanumeric': 0.18983050847457628, 'fraction_numerical': 0.002542372881355932, 'mean_word_length': 4.567216981132075, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 55, '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': '3170520', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1520, 'n_words': 366}