<commit_before><?php
require_once "config.php";
require_once "pdo.php";
require_once("lib/util.php");

header('Content-type: application/json');

$p = $CFG->dbprefix;
$user_id = false;
if ( isset($_GET['pair']) ) {
    $row = pdoRowDie($pdo, "SELECT user_id FROM {$p}pair WHERE pair_key = :PK",
        array(':PK' => $_GET['pair']) );
    if ( $row !== false ) $user_id = $row['user_id'];
} else {
    session_start();
    $user_id = $_SESSION['id'];
}

if ( $user_id === false ) {
	echo('{ "error" : "Not logged in"}');
    return;
}

$p = $CFG->dbprefix;
if ( isset($_GET['game']) ) { // I am player 1 since I made this game
	$stmt = $pdo->prepare("SELECT play1, play2, displayname FROM {$p}rps 
		LEFT JOIN {$p}user ON {$p}rps.user2_id = {$p}user.user_id
		WHERE rps_guid = :GUID");
	$stmt->execute(array(":GUID" => $_GET['game']));<commit_msg>Fix small bugs identified in Android App Testing.<commit_after><?php
require_once "config.php";
require_once "pdo.php";
require_once("lib/util.php");

header('Content-type: application/json');

$p = $CFG->dbprefix;
$user_id = false;
if ( isset($_GET['pair']) ) {
    $row = pdoRowDie($pdo, "SELECT user_id FROM {$p}pair WHERE pair_key = :PK",
        array(':PK' => $_GET['pair']) );
    if ( $row !== false ) $user_id = $row['user_id'];
} else {
    session_start();
    if ( isset($_SESSION['user_id']) ) $user_id = $_SESSION['id'];
}

if ( $user_id === false ) {
	echo('{ "error" : "Not logged in"}');
    return;
}

$p = $CFG->dbprefix;
if ( isset($_GET['game']) ) { // I am player 1 since I made this game
	$stmt = $pdo->prepare("SELECT play1, play2, displayname FROM {$p}rps 
		LEFT JOIN {$p}user ON {$p}rps.user2_id = {$p}user.user_id
		WHERE rps_guid = :GUID");
	$stmt->execute(array(":GUID" => $_GET['game']));
{'fraction_non_alphanumeric': 0.21844934917940012, 'fraction_numerical': 0.004527447651386531, 'mean_word_length': 4.341389728096677, 'pattern_counts': {'":': 2, '<': 5, '<?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': '6007634', 'n_tokens_mistral': 672, 'n_tokens_neox': 669, 'n_words': 156}