mirror of
https://github.com/foin137/werwolfonline.eu.git
synced 2025-12-12 03:11:35 +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:
36
Werwolf.php
36
Werwolf.php
@@ -3940,9 +3940,12 @@ function setBereit($mysqli,$spielerID,$bereit)
|
||||
function gameAssoc($mysqli)
|
||||
{
|
||||
$spielID = $_COOKIE['SpielID'];
|
||||
$gameRes = $mysqli->Query("SELECT * FROM $spielID"."_game");
|
||||
$gameA = $gameRes->fetch_assoc();
|
||||
return $gameA;
|
||||
if ($gameRes = $mysqli->Query("SELECT * FROM $spielID"."_game"))
|
||||
{
|
||||
$gameA = $gameRes->fetch_assoc();
|
||||
return $gameA;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function eigeneAssoc($mysqli)
|
||||
@@ -3959,9 +3962,12 @@ function getName($mysqli, $spielerID)
|
||||
//Gibt den Namen des Spielers mit der $spielerID zurück
|
||||
$spielID = $_COOKIE['SpielID'];
|
||||
$spielerID = (int)$spielerID;
|
||||
$res = $mysqli->Query("SELECT * FROM $spielID"."_spieler WHERE id = $spielerID");
|
||||
$temp = $res->fetch_assoc();
|
||||
return $temp['name'];
|
||||
if ($res = $mysqli->Query("SELECT * FROM $spielID"."_spieler WHERE id = $spielerID"))
|
||||
{
|
||||
$temp = $res->fetch_assoc();
|
||||
return $temp['name'];
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
function getGesinnung($identitaet)
|
||||
@@ -4092,14 +4098,16 @@ function toGameLog($mysqli,$logeintrag)
|
||||
{
|
||||
//Fügt dem gamelog den $logeintrag hinzu
|
||||
$spielID = $_COOKIE['SpielID'];
|
||||
$gameAssoc = gameAssoc($mysqli);
|
||||
$aktLog = $gameAssoc['log'];
|
||||
$neuLog = $aktLog.date("H:i:s").": ".$logeintrag."<br>";
|
||||
$neuLog = str_replace("'",'"',$neuLog); //ersetze alle ' mit "
|
||||
$stmt = $mysqli->prepare("UPDATE $spielID"."_game SET log = ?");
|
||||
$stmt->bind_param("s",$neuLog);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
if ($gameAssoc = gameAssoc($mysqli))
|
||||
{
|
||||
$aktLog = $gameAssoc['log'];
|
||||
$neuLog = $aktLog.date("H:i:s").": ".$logeintrag."<br>";
|
||||
$neuLog = str_replace("'",'"',$neuLog); //ersetze alle ' mit "
|
||||
$stmt = $mysqli->prepare("UPDATE $spielID"."_game SET log = ?");
|
||||
$stmt->bind_param("s",$neuLog);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
}
|
||||
}
|
||||
|
||||
function toPlayerLog($mysqli, $logeintrag, $spieler)
|
||||
|
||||
Reference in New Issue
Block a user