database namen zu konstante gemacht
This commit is contained in:
parent
22db148e39
commit
07677cebb5
8 changed files with 9 additions and 7 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
constants.php
|
|
@ -3,7 +3,7 @@
|
|||
require("database.php");
|
||||
require("GetUserMostPlayed.php");
|
||||
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
while(true) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require("database.php");
|
||||
require("RequestMutualScores.php");
|
||||
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
while(true) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ if (!function_exists("CheckMutualMaps")) {
|
|||
function CheckMutualMaps($player1, $player2) {
|
||||
require("database.php");
|
||||
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
$query = "SELECT a.map_id
|
||||
FROM UserMostPlayed a
|
||||
|
|
|
@ -4,7 +4,7 @@ require("database.php");
|
|||
require("constants.php");
|
||||
|
||||
function getScore($player1, $player2, $random) {
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
$query = "SELECT
|
||||
a.map_id,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require("database.php");
|
||||
require("constants.php");
|
||||
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
if (!function_exists("getPlays")) {
|
||||
function getPlays() {
|
||||
|
|
|
@ -6,10 +6,11 @@ if(!class_exists("Database")) {
|
|||
private $rows;
|
||||
|
||||
public function __construct($host, $dbname, $user, $psswd) {
|
||||
|
||||
try {
|
||||
|
||||
$dsn = "mysql:host=$host;dbname=$dbname;charset=utf8mb4";
|
||||
$this->pdo = new PDO($dsn, $user, $psswd);
|
||||
$this->pdo = new PDO($dsn, $user, (!isset($psswd)) ? "" : $psswd);
|
||||
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
|
|
|
@ -4,7 +4,7 @@ require("database.php");
|
|||
require("constants.php");
|
||||
require("GetComparableScores.php");
|
||||
|
||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
||||
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||
|
||||
$player1 = $_GET['target'];
|
||||
$player2 = $_GET['player'];
|
||||
|
|
Loading…
Reference in a new issue