Question by
prateek1234 · May 02, 2017 at 08:58 PM ·
serverphphighscoresserver-hosting
error in posting highscore to server
i want to upload player score to my data base but there was an error in posting highscore this is my php script & database image // Configuration $hostname = 'localhost'; $username = 'id_prateek'; $password = 'to12r1'; $database = 'i_high';
$secretKey = "123546789"; // Change this value to match the value stored in the client javascript below
try { $dbh = new PDO('mysql:host='. $hostname .';dbname='. $database, $username, $password); } catch(PDOException $e) { echo '
An error has ocurred.
', $e->getMessage() ,''; } if(isset($_GET["name"&&"scores"])){ $realHash = md5($_GET['name'] . $_GET['score'] . $secretKey); } if(isset($_GET["hash"])){ if($realHash == $hash) { $sth = $dbh->prepare('INSERT INTO scores VALUES (null, :name, :score)'); try { $sth->execute($_GET); } catch(Exception $e) { echo '
An error has ocurred.
', $e->getMessage() ,''; } } } ?> ?>
screenshot-16.png
(60.3 kB)
Comment