-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathajax.php
More file actions
36 lines (31 loc) · 1.23 KB
/
Copy pathajax.php
File metadata and controls
36 lines (31 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Created by PhpStorm.
* User: Bart
* Date: 20/06/2015
* Time: 11:58
*/
$host = "127.0.0.1";
$database = "invader";
$user = "root";
$pass = "";
try {
$dbh = new PDO('mysql:host='.$host.';dbname='.$database, $user, $pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
if( isset( $_POST ) ) {
$req = $dbh->prepare("INSERT INTO highscore (playername, playerscore, playerlevel, statsdestroyed, statsmissed, statsshotfired, dateplayed)
VALUES (:playername, :playerscore, :playerlevel, :statsdestroyed, :statsmissed, :statsshotfired, :dateplayed)");
$req->bindParam(':playername', $_POST['playername']);
$req->bindParam(':playerscore', $_POST['playerscore']);
$req->bindParam(':playerlevel', $_POST['playerlevel']);
$req->bindParam(':statsdestroyed', $_POST['statsdestroyed']);
$req->bindParam(':statsmissed', $_POST['statsmissed']);
$req->bindParam(':statsshotfired', $_POST['statsshotfired']);
$nowdate = new \DateTime('now');
$req->bindParam(':dateplayed', $date, PDO::PARAM_STR);
$req->execute();
}
$dbh = null;
} catch (PDOException $e) {
header("location: index.php");
}
header("location: ranking.php");