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("database.php");
|
||||||
require("GetUserMostPlayed.php");
|
require("GetUserMostPlayed.php");
|
||||||
|
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require("database.php");
|
require("database.php");
|
||||||
require("RequestMutualScores.php");
|
require("RequestMutualScores.php");
|
||||||
|
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ if (!function_exists("CheckMutualMaps")) {
|
||||||
function CheckMutualMaps($player1, $player2) {
|
function CheckMutualMaps($player1, $player2) {
|
||||||
require("database.php");
|
require("database.php");
|
||||||
|
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
$query = "SELECT a.map_id
|
$query = "SELECT a.map_id
|
||||||
FROM UserMostPlayed a
|
FROM UserMostPlayed a
|
||||||
|
|
|
@ -4,7 +4,7 @@ require("database.php");
|
||||||
require("constants.php");
|
require("constants.php");
|
||||||
|
|
||||||
function getScore($player1, $player2, $random) {
|
function getScore($player1, $player2, $random) {
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
$query = "SELECT
|
$query = "SELECT
|
||||||
a.map_id,
|
a.map_id,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require("database.php");
|
require("database.php");
|
||||||
require("constants.php");
|
require("constants.php");
|
||||||
|
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
if (!function_exists("getPlays")) {
|
if (!function_exists("getPlays")) {
|
||||||
function getPlays() {
|
function getPlays() {
|
||||||
|
|
|
@ -6,10 +6,11 @@ if(!class_exists("Database")) {
|
||||||
private $rows;
|
private $rows;
|
||||||
|
|
||||||
public function __construct($host, $dbname, $user, $psswd) {
|
public function __construct($host, $dbname, $user, $psswd) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$dsn = "mysql:host=$host;dbname=$dbname;charset=utf8mb4";
|
$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);
|
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ require("database.php");
|
||||||
require("constants.php");
|
require("constants.php");
|
||||||
require("GetComparableScores.php");
|
require("GetComparableScores.php");
|
||||||
|
|
||||||
$database = new Database("localhost", "ScoreSniper", MARIAUSER, MARIAPASSWD);
|
$database = new Database("localhost", DATABASE, MARIAUSER, MARIAPASSWD);
|
||||||
|
|
||||||
$player1 = $_GET['target'];
|
$player1 = $_GET['target'];
|
||||||
$player2 = $_GET['player'];
|
$player2 = $_GET['player'];
|
||||||
|
|
Loading…
Reference in a new issue