mirror of
https://github.com/foin137/werwolfonline.eu.git
synced 2025-12-12 11:21:22 +00:00
[#27] Fix bug when deleting games
Makes sure that when we want to exit a game and the game is not there anymore, we can reset our cookies. Fixes #27, at least partially, there are still error messages, but at least it's playable again
This commit is contained in:
14
Werwolf.php
14
Werwolf.php
@@ -3940,9 +3940,12 @@ function setBereit($mysqli,$spielerID,$bereit)
|
|||||||
function gameAssoc($mysqli)
|
function gameAssoc($mysqli)
|
||||||
{
|
{
|
||||||
$spielID = $_COOKIE['SpielID'];
|
$spielID = $_COOKIE['SpielID'];
|
||||||
$gameRes = $mysqli->Query("SELECT * FROM $spielID"."_game");
|
if ($gameRes = $mysqli->Query("SELECT * FROM $spielID"."_game"))
|
||||||
|
{
|
||||||
$gameA = $gameRes->fetch_assoc();
|
$gameA = $gameRes->fetch_assoc();
|
||||||
return $gameA;
|
return $gameA;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function eigeneAssoc($mysqli)
|
function eigeneAssoc($mysqli)
|
||||||
@@ -3959,9 +3962,12 @@ function getName($mysqli, $spielerID)
|
|||||||
//Gibt den Namen des Spielers mit der $spielerID zurück
|
//Gibt den Namen des Spielers mit der $spielerID zurück
|
||||||
$spielID = $_COOKIE['SpielID'];
|
$spielID = $_COOKIE['SpielID'];
|
||||||
$spielerID = (int)$spielerID;
|
$spielerID = (int)$spielerID;
|
||||||
$res = $mysqli->Query("SELECT * FROM $spielID"."_spieler WHERE id = $spielerID");
|
if ($res = $mysqli->Query("SELECT * FROM $spielID"."_spieler WHERE id = $spielerID"))
|
||||||
|
{
|
||||||
$temp = $res->fetch_assoc();
|
$temp = $res->fetch_assoc();
|
||||||
return $temp['name'];
|
return $temp['name'];
|
||||||
|
}
|
||||||
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGesinnung($identitaet)
|
function getGesinnung($identitaet)
|
||||||
@@ -4092,7 +4098,8 @@ function toGameLog($mysqli,$logeintrag)
|
|||||||
{
|
{
|
||||||
//Fügt dem gamelog den $logeintrag hinzu
|
//Fügt dem gamelog den $logeintrag hinzu
|
||||||
$spielID = $_COOKIE['SpielID'];
|
$spielID = $_COOKIE['SpielID'];
|
||||||
$gameAssoc = gameAssoc($mysqli);
|
if ($gameAssoc = gameAssoc($mysqli))
|
||||||
|
{
|
||||||
$aktLog = $gameAssoc['log'];
|
$aktLog = $gameAssoc['log'];
|
||||||
$neuLog = $aktLog.date("H:i:s").": ".$logeintrag."<br>";
|
$neuLog = $aktLog.date("H:i:s").": ".$logeintrag."<br>";
|
||||||
$neuLog = str_replace("'",'"',$neuLog); //ersetze alle ' mit "
|
$neuLog = str_replace("'",'"',$neuLog); //ersetze alle ' mit "
|
||||||
@@ -4100,6 +4107,7 @@ function toGameLog($mysqli,$logeintrag)
|
|||||||
$stmt->bind_param("s",$neuLog);
|
$stmt->bind_param("s",$neuLog);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toPlayerLog($mysqli, $logeintrag, $spieler)
|
function toPlayerLog($mysqli, $logeintrag, $spieler)
|
||||||
|
|||||||
Reference in New Issue
Block a user