Unityから呼び出したサーバ側に設置するPHPです
<?php
$db = mysql_connect('severurl', 'sq_lusername', 'sql_password') or die('Could not connect: ' . mysql_error());
mysql_select_db('sql?database_name') or die('Could not select database');
// Strings must be escaped to prevent SQL injection attack.
$name = mysql_real_escape_string($_GET['name'], $db);
$score = mysql_real_escape_string($_GET['score'], $db);
$cName = mysql_real_escape_string($_GET['cName'], $db);
$hash = $_GET['hash'];
$secretKey="****"; # Change this value to match the value stored in the client javascript below
$real_hash = md5($name . $score . $cName . $secretKey);
if($real_hash == $hash) {
// Send variables for the MySQL database class.
$query = "insert into scores values (NULL, '$name', '$score', '$cName');";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
}
?>
スコアを追加できます