<commit_before><?php
include('header.php');


#$userid=isloggedin();
if ($userid)
{
	$question = $_POST['question'];
	$room = $_POST['room'];
	$urlquery = CreateQuestionURL($question, $room);

	$sql = "SELECT * FROM updates WHERE question = ".$question." AND  user = ".$userid." LIMIT 1 ";
	$response = mysql_query($sql);
	$row = mysql_fetch_array($response);

	if ($row)
	{

		$sql = "DELETE FROM updates WHERE  updates.question = " . $question . " AND updates.user = " . $userid . "  ";
		if (!mysql_query($sql)) error("Database update failed");
		#mysql_query($sql);
	}else{
		$how="asap";
		$sql = 'INSERT INTO `updates` (`user`, `question`, `how`) VALUES (\'' . $userid . '\', \'' . $question . '\', \'' . $how . '\');';
		if (!mysql_query($sql)) error("Database update failed");
		#mysql_query($sql);
	}
	header("Location: viewquestion.php".$urlquery);
}
else
{
		header("Location: login.php");
}
?><commit_msg>security issue. The system checks that you were in the room of a question before letting you subscribe to that.<commit_after><?php
include('header.php');


#$userid=isloggedin();
if ($userid)
{
	$question = $_POST['question'];
	$room = $_POST['room'];
	
	
	if ($room==GetQuestionRoom($question))
	{
	
		$urlquery = CreateQuestionURL($question, $room);

		$sql = "SELECT * FROM updates WHERE question = ".$question." AND  user = ".$userid." LIMIT 1 ";
		$response = mysql_query($sql);
		$row = mysql_fetch_array($response);

		if ($row)
		{
			$sql = "DELETE FROM updates WHERE  updates.question = " . $question . " AND updates.user = " . $userid . "  ";
			if (!mysql_query($sql)) error("Database update failed");
			#mysql_query($sql);
		}else{
			$how="asap";
			$sql = 'INSERT INTO `updates` (`user`, `question`, `how`) VALUES (\'' . $userid . '\', \'' . $question . '\', \'' . $how . '\');';
			if (!mysql_query($sql)) error("Database update failed");
			#mysql_query($sql);
		}
	}
	header("Location: viewquestion.php".$urlquery);
}
else
{
		header("Location: login.php");
}
?>
{'fraction_non_alphanumeric': 0.21421421421421422, 'fraction_numerical': 0.001001001001001001, 'mean_word_length': 4.086513994910941, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2798364', 'n_tokens_mistral': 726, 'n_tokens_neox': 684, 'n_words': 161}