<commit_before><?php
$access_token = "<KEY>";
$verify_token = "<PASSWORD>";
$hub_verify_token = null;

function generateRandomString($length = 10) {
	$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	$charactersLength = strlen($characters);
	$randomString = '';
	for ($i = 0; $i < $length; $i++) {
		$randomString .= $characters[rand(0, $charactersLength - 1)];
	}
	return $randomString;
} 

//database calls
/*$dbHost = 'ec2-54-243-243-135.compute-1.amazonaws.com';
$dbUsername = 'd5gei6idamag9h';
$dbPassword = '<PASSWORD>';
$dbName = 'd5gei6idamag9h';
$myPDO = new PDO('pgsql:host='+$dbHost+';dbname='+$dbName, $dbUsername, $dbName);*/
$counter='hi';

# This function reads your DATABASE_URL configuration automatically set by Heroku
# the return value is a string that will work with pg_connect
function pg_connection_string() {
  return "dbname=d270g74n5lg3ni host=ec2-50-16-218-45.compute-1.amazonaws.com port=5432 user=iuyrqoboxxpsri password=<PASSWORD>2d2AyWKjE8 sslmode=require";
}
 
# Establish db connection
$db = pg_connect(pg_connection_string());
if (!$db) {
    echo "Database connection error.";
    exit;
}
$counter = pg_query($db, "SELECT userID FROM players WHERE id=1");

$isGame = array();
$gameHoster = array();
$input = json_decode(file_get_contents('php://input'), true);
$sender = $input['entry'][0]['messaging'][0]['sender']['id'];
$message = $input['entry'][0]['messaging'][0]['message']['text'];
$message_to_reply = '';
/**
 * Some Basic rules to validate incoming messages
 */
/*if(preg_match('[time|current time|now]', strtolower($message))) {
    // Make request to Time API
    ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
    $result = file_get_contents("http://www.timeapi.org/utc/now?format=%25a%20%25b%20%25d%20%25I:%25M:%25S%20%25Y");
    if($result != '') {
        $message_to_reply = $result;
    }
} else {
    $message_to_reply = 'Huh! what do you mean?';
}*/
if(preg_match('[start game]', strtolower($message))) {
	$counter=$counter+1;
	$gameID=generateRandomString();
	$isGame[$gameID]=true;
	$gameHoster[$gameID]=$sender;
	$message_to_reply = $counter;<commit_msg>database test v1.0<commit_after><?php
$access_token = "<KEY>";
$verify_token = "<PASSWORD>";
$hub_verify_token = null;

function generateRandomString($length = 10) {
	$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	$charactersLength = strlen($characters);
	$randomString = '';
	for ($i = 0; $i < $length; $i++) {
		$randomString .= $characters[rand(0, $charactersLength - 1)];
	}
	return $randomString;
} 

//database calls
/*$dbHost = 'ec2-54-243-243-135.compute-1.amazonaws.com';
$dbUsername = 'd5gei6idamag9h';
$dbPassword = '<PASSWORD>';
$dbName = 'd5gei6idamag9h';
$myPDO = new PDO('pgsql:host='+$dbHost+';dbname='+$dbName, $dbUsername, $dbName);*/
$counter='hi';

# This function reads your DATABASE_URL configuration automatically set by Heroku
# the return value is a string that will work with pg_connect
function pg_connection_string() {
  return "dbname=d270g74n5lg3ni host=ec2-50-16-218-45.compute-1.amazonaws.com port=5432 user=iuyrqoboxxpsri password=<PASSWORD> sslmode=require";
}
 
# Establish db connection
$db = pg_connect(pg_connection_string());
if (!$db) {
    echo "Database connection error.";
    exit;
}
$counter = pg_query($db, "SELECT userID FROM players WHERE id=1");

$isGame = array();
$gameHoster = array();
$input = json_decode(file_get_contents('php://input'), true);
$sender = $input['entry'][0]['messaging'][0]['sender']['id'];
$message = $input['entry'][0]['messaging'][0]['message']['text'];
$message_to_reply = '';
/**
 * Some Basic rules to validate incoming messages
 */
/*if(preg_match('[time|current time|now]', strtolower($message))) {
    // Make request to Time API
    ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
    $result = file_get_contents("http://www.timeapi.org/utc/now?format=%25a%20%25b%20%25d%20%25I:%25M:%25S%20%25Y");
    if($result != '') {
        $message_to_reply = $result;
    }
} else {
    $message_to_reply = 'Huh! what do you mean?';
}*/
if(preg_match('[start game]', strtolower($message))) {
	$gameID=generateRandomString();
	$isGame[$gameID]=true;
	$gameHoster[$gameID]=$sender;
	$message_to_reply = $counter;
{'fraction_non_alphanumeric': 0.18491711417230913, 'fraction_numerical': 0.042026616857342984, 'mean_word_length': 6.069306930693069, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '445556', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1577, 'n_words': 290}