<commit_before><?php

function connect_to_db() {
	####################################
	# Database connection information   #
	#####################################

	$hostname = "localhost";
	$database = "csescholars";
	$username = "cseschol";
	$password = "<PASSWORD>";

	$db = mysql_connect($hostname, $username, $password);
	if (!$db)
	{
		echo '<p>Error connecting to database!</p>';
		exit;
	}
	mysql_select_db($database, $db);

	return $db;
}


//Created by: jsallans
//Date: 8-28-12
//Change: new
//Purpose: to make data base connections easier

function connect_to_db_with_sqli() {
	####################################
	# Database connection information   #
	#####################################

	$hostname = "localhost";
	$database = "csescholars";
	$username = "cseschol";
	$password = "<PASSWORD>";

	$conn = new mysqli($hostname, $username, $password, $database) or die("<p> Error connecting to database. </p>");

	return $conn;
}

//PURPOSE: will check if the file is a PDF then uploads it
function AddResume($temp_files, $uniqname, $save_path) {

	//$temp_files is passed as $_FILES

	//check if file ends with ".pdf"
	if (substr_compare($temp_files['resumeFile']['name'], ".pdf", -4) === 0)
	{
		//DeleteResume($uniqname, $save_path);

		if (move_uploaded_file($temp_files['resumeFile']['tmp_name'], $save_path)) {

			//Mark resume exists
			connect_to_db();
			mysql_query("UPDATE members SET hasResume = 1 WHERE uniqname = '$uniqname' AND deleted=0");

			return "Resume successfuly uploaded.";
		}
		else {

			return "" . var_dump($_FILES['resumeFile']);
			//return "File didn't upload.";
		}
	}
	else
	{
		return "Resume needs to be a .pdf";
	}

}


//______________Before Jeff_________________________


function FormatGradDate($gradMonth, $gradYear)
{
	if (($gradMonth < 1)||($gradMonth > 12))
	{
		if ($gradYear < 2000)
			return "";
		else
			return $gradYear;
	}
	if ($gradYear < 2000)
		return date( 'F', mktime(0, 0, 0, $gradMonth));
	return date( 'F', mktime(0, 0, 0, $gradMonth)).", ".$gradYear;
}

function DeleteResume($uniqname, $path)
{
	if (file_exists($path))
		unlink($path); //remove

	//Unmark resume exists
	connect_to_db();
	mysql_query("UPDATE members SET hasResume = 0 WHERE uniqname = '$uniqname' AND deleted=0");

}

function PrintPollResults($pid)
{
	//print votes in decending order here
	$totalVotes = 0;
	$html = "<table>\n";
	$query = mysql_query("SELECT vote, count(vote) as Frequency from votes WHERE uniqname != '' AND poll_id = '$pid' GROUP BY vote ORDER BY Frequency DESC");
	while ($voteData = mysql_fetch_row($query))
	{
			$html .= "\t<tr><td>".stripslashes(stripslashes($voteData[0])).": </td><td>&nbsp;";
			$numVotes = $voteData[1];
			$totalVotes += $numVotes;
			$html .= $numVotes."</td></tr>\n";
	}
	$html .= "\t<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";
	$html .= "\t<tr><td>Total Votes: </td><td>&nbsp;$totalVotes</td></tr>\n";
	$html .= "</table>\n\n";

	return $html;

}

//returns full name of member
//assumes db is set
function GetFullName($uniquename)
{
	$query = mysql_query("SELECT name FROM members WHERE uniquename = '$uniquename' LIMIT 1");
	if (mysql_num_rows($query) == 0)
		return "";
	$name = mysql_fetch_row($query);
	return stripslashes($name[0]);
}

function PrintGPA($gpa)
{
	if ($gpa != 0)
	{
		echo $gpa;
		if (strlen($gpa) == 1)
			echo ".00";
		if (strlen($gpa) == 3)
			echo "0";
	}
}

?>
<commit_msg>another fix2<commit_after><?php

function connect_to_db() {
	####################################
	# Database connection information   #
	#####################################

	$hostname = "localhost";
	$database = "csescholars";
	$username = "cseschol";
	$password = "<PASSWORD>";

	$db = mysql_connect($hostname, $username, $password);
	if (!$db)
	{
		echo '<p>Error connecting to database!</p>';
		exit;
	}
	mysql_select_db($database, $db);

	return $db;
}


//Created by: jsallans
//Date: 8-28-12
//Change: new
//Purpose: to make data base connections easier

function connect_to_db_with_sqli() {
	####################################
	# Database connection information   #
	#####################################

	$hostname = "localhost";
	$database = "csescholars";
	$username = "cseschol";
	$password = "<PASSWORD>";

	$conn = new mysqli($hostname, $username, $password, $database) or die("<p> Error connecting to database. </p>");

	return $conn;
}

//PURPOSE: will check if the file is a PDF then uploads it
function AddResume($temp_files, $uniqname, $save_path) {

	//$temp_files is passed as $_FILES

	//check if file ends with ".pdf"
	if (substr_compare($temp_files['resumeFile']['name'], ".pdf", -4) === 0)
	{
		//DeleteResume($uniqname, $save_path);

		if (move_uploaded_file($temp_files['resumeFile']['tmp_name'], $save_path)) {

			//Mark resume exists
			connect_to_db();
			mysql_query("UPDATE members SET hasResume = 1 WHERE uniqname = '$uniqname' AND deleted=0");

			return "Resume successfuly uploaded.";
		}
		else {

			die(var_dump($_FILES['resumeFile']));
			//return "File didn't upload.";
		}
	}
	else
	{
		return "Resume needs to be a .pdf";
	}

}


//______________Before Jeff_________________________


function FormatGradDate($gradMonth, $gradYear)
{
	if (($gradMonth < 1)||($gradMonth > 12))
	{
		if ($gradYear < 2000)
			return "";
		else
			return $gradYear;
	}
	if ($gradYear < 2000)
		return date( 'F', mktime(0, 0, 0, $gradMonth));
	return date( 'F', mktime(0, 0, 0, $gradMonth)).", ".$gradYear;
}

function DeleteResume($uniqname, $path)
{
	if (file_exists($path))
		unlink($path); //remove

	//Unmark resume exists
	connect_to_db();
	mysql_query("UPDATE members SET hasResume = 0 WHERE uniqname = '$uniqname' AND deleted=0");

}

function PrintPollResults($pid)
{
	//print votes in decending order here
	$totalVotes = 0;
	$html = "<table>\n";
	$query = mysql_query("SELECT vote, count(vote) as Frequency from votes WHERE uniqname != '' AND poll_id = '$pid' GROUP BY vote ORDER BY Frequency DESC");
	while ($voteData = mysql_fetch_row($query))
	{
			$html .= "\t<tr><td>".stripslashes(stripslashes($voteData[0])).": </td><td>&nbsp;";
			$numVotes = $voteData[1];
			$totalVotes += $numVotes;
			$html .= $numVotes."</td></tr>\n";
	}
	$html .= "\t<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";
	$html .= "\t<tr><td>Total Votes: </td><td>&nbsp;$totalVotes</td></tr>\n";
	$html .= "</table>\n\n";

	return $html;

}

//returns full name of member
//assumes db is set
function GetFullName($uniquename)
{
	$query = mysql_query("SELECT name FROM members WHERE uniquename = '$uniquename' LIMIT 1");
	if (mysql_num_rows($query) == 0)
		return "";
	$name = mysql_fetch_row($query);
	return stripslashes($name[0]);
}

function PrintGPA($gpa)
{
	if ($gpa != 0)
	{
		echo $gpa;
		if (strlen($gpa) == 1)
			echo ".00";
		if (strlen($gpa) == 3)
			echo "0";
	}
}

?>

{'fraction_non_alphanumeric': 0.2184737772539776, 'fraction_numerical': 0.011932822628167354, 'mean_word_length': 4.466183574879227, 'pattern_counts': {'":': 2, '<': 63, '<?xml version=': 0, '>': 59, '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': '4800256', 'n_tokens_mistral': 2588, 'n_tokens_neox': 2396, 'n_words': 594}