From 072057d86c629b01b8aa439e37156ab93fb9f7e3 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Tue, 23 Jun 2020 18:13:46 +0300 Subject: [PATCH] Removed Telegraf due to database loss --- enter.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/enter.php b/enter.php index 0aa7f83..2d340dc 100644 --- a/enter.php +++ b/enter.php @@ -32,20 +32,21 @@ if ($username && $password) { setcookie("hashcode", md5($data['id'] . $data["pass"] . $data["login"]), time() + 43200, "/", GAMEDOMAIN); $_SESSION['sid'] = session_id(); - $onl = db::c()->query('SELECT `id` FROM `online` WHERE `id` = "?s"', $data['id'])->fetch_assoc(); + $onl = db::c()->query('SELECT user_id FROM online WHERE user_id = "?s"', $data['id'])->fetch_assoc(); if (isset($onl['id'])) { - db::c()->query('UPDATE `online` SET `date` = ?i WHERE `id` = "?s"', time(), $data['id']); + db::c()->query('UPDATE online SET date = ?i WHERE user_id = "?s"', time(), $data['id']); } else { - db::c()->query('INSERT INTO `online` (`id`, `date`, `room`) VALUES (?i, ?i, ?i)', $data['id'], time(), $data['room']); + db::c()->query('INSERT INTO online (user_id, date, room) VALUES (?i, ?i, ?i)', $data['id'], time(), $data['room']); } db::c()->query('UPDATE `users` SET `sid` = "?s", `enter_game` = ?i WHERE `id` = ?i', session_id(), 1, $data['id']); +// DEPRECATED. NO TABLE IN DB! +// $sms = db::c()->query('SELECT * FROM `telegraph` WHERE `receiver` = ?i', $data['id']); +// while ($res = $sms->fetch_assoc()) { +// db::c()->query('INSERT INTO `chat` (`touid`, `msg`, `type`) VALUES (?i, "?s", "?s")', $res['receiver'], $res['text'], 'sms'); +// } +// db::c()->query('DELETE FROM `telegraph` WHERE `receiver` = ?i', $data['id']); - $sms = db::c()->query('SELECT * FROM `telegraph` WHERE `receiver` = ?i', $data['id']); - while ($res = $sms->fetch_assoc()) { - db::c()->query('INSERT INTO `chat` (`touid`, `msg`, `type`) VALUES (?i, "?s", "?s")', $res['receiver'], $res['text'], 'sms'); - } - db::c()->query('DELETE FROM `telegraph` WHERE `receiver` = ?i', $data['id']); header("Location: fight.php"); } }