<?php
/*
The following variables need to be changed to your webserver details
Ensure the variables names themselves remain the same though
*/
$db_name = 'amusich_sr_scores'; // Database name
$username = 'amusich_amusic'; //Your database username
$password = 'jingle330036'; //Your database password (for logging in with above username)
$host = 'localhost'; // hostedAddress - in the form of a link if on a website?
$tbl_name = 'scores'; // Table name in which is being accessed - i,e "gamescoreboard"
if(isset($_POST['name']) && isset($_POST['score']))
{
// sanitize the GET's to help prevent SQL injection or attacks - possibly not 100% safe, but can help!
// provjera da li name+score postoji
$check=mysql_query("SELECT * FROM `$db_name`.`$tbl_name` WHERE `name`='".$name."' AND `score`=".$score);
echo "name=".$name;
echo "score=".$score;
{
// ne postoji rezultat sa tim $name i $score
// insert novog
$sql = mysql_query("INSERT INTO `$db_name`.`$tbl_name` (`name`,`score`) VALUES (\"$name\", $score );");
}
//if($sql)
{
//The query returned true, we're done here!
echo 'Your score was saved to the database, we are done here!';
}
else
{
//The query returned false, this isn't good! Log report to text file for further analysis?
echo 'Your score could not be saved, if this continues please check your database or contact the developer :)';
}
}
else
{
echo 'Your name or score wasnt passed in the request. Make sure the values were passed in from C# correctly.';
}
// close the SQL database link, so resources are saved and constant communication between the application and database host doesn't affect use
?>