<?php
//formerly games.php
//moved here to get rid of one more file.
//also used for multiple difficulties for one game.

if($game == 1)//Connected We Run
{
$max = 50000;
}
//end of former games.php

include("./db.php");
header('Access-Control-Allow-Origin: *');

$name = mysqli_real_escape_string($mysqli, $_GET['name']);
$game = mysqli_real_escape_string($mysqli,$_GET['game']);
$score = mysqli_real_escape_string($mysqli,$_GET['score']);
$time = mysqli_real_escape_string($mysqli,time());
$ip = mysqli_real_escape_string($mysqli,$_SERVER['REMOTE_ADDR']);

if(($score <= $max) ||($max == 0))
{
 $runquery = 1;
}


if($runquery == 1)
{
 mysqli_query($mysqli, "INSERT INTO `highscores` (name,score,ip,game,time) VALUES ('$name','$score','$ip','$game','$time')");
 echo "Inserted";
}

?>
