<commit_before><?php
include 'base.php';

if (!$_SESSION['Blaze_LoggedIn'])
{
	echo 'you shall not pass';
	return;
}


$question_url = $_POST["url"];

$db = PDODatabaseObject();
$stmt = $db->prepare('SELECT * FROM flags WHERE postUrl=:url');
$stmt->execute(array(":url" => $question_url));
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($results) > 0)
{
	echo "already flagged";
	return;
}
$stmt = $db->prepare("INSERT INTO flags(postUrl) VALUES(:postUrl)");
$stmt->execute(array(':postUrl' => $question_url));

echo exec("python report.py 'answer flagged by " . escapeshellarg($_SESSION['Blaze_Username']) . ": " . escapeshellarg($question_url) . "' '" . SEChatUsername() . "' '" . SEChatPassword() . "'");<commit_msg>Add in backend for #9<commit_after><?php
include 'base.php';

if (!$_SESSION['Blaze_LoggedIn'])
{
	echo 'you shall not pass';
	return;
}


$question_url = $_POST["url"];
$body = $_POST["body"];

$db = PDODatabaseObject();
$stmt = $db->prepare('SELECT * FROM flags WHERE postUrl=:url');
$stmt->execute(array(":url" => $question_url));
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($results) > 0)
{
	echo "already flagged";
	return;
}
$stmt = $db->prepare("INSERT INTO flags(postUrl, body) VALUES(:postUrl, :body)");
$stmt->execute(array(':postUrl' => $question_url, ':body' => $body));

echo exec("python report.py 'answer flagged by " . escapeshellarg($_SESSION['Blaze_Username']) . ": " . escapeshellarg($question_url) . "' '" . SEChatUsername() . "' '" . SEChatPassword() . "'");
{'fraction_non_alphanumeric': 0.21922317314022383, 'fraction_numerical': 0.0019749835418038184, 'mean_word_length': 6.069767441860465, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 20, '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': '862941', 'n_tokens_mistral': 542, 'n_tokens_neox': 528, 'n_words': 108}