From c73cf5e65c9f54077d5ba6b941064c94341c20f1 Mon Sep 17 00:00:00 2001 From: jupo Date: Thu, 19 Sep 2024 03:04:58 +0000 Subject: [PATCH] Upload files to "website/game" --- website/game/msg-read.php | 67 ++++++++++++++++++++++++++++++++++++++ website/game/msg-send.php | 68 +++++++++++++++++++++++++++++++++++++++ website/game/msg.php | 61 +++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 website/game/msg-read.php create mode 100644 website/game/msg-send.php create mode 100644 website/game/msg.php diff --git a/website/game/msg-read.php b/website/game/msg-read.php new file mode 100644 index 0000000..67a6d0f --- /dev/null +++ b/website/game/msg-read.php @@ -0,0 +1,67 @@ + +Frontier II + + + +

CommLink

"; + + $show = $_POST['SHOW']; + $character_id = $_SESSION['cid']; + + if ($show == 'ALL') { // Display all messages + + $sql = "SELECT * FROM `message` WHERE + `to` = '$character_id'"; + + } else { // This should not happen... + + $sql = "SELECT * FROM `message` WHERE `id` = '0'"; + + } + + $result = mysqli_query($mysqli, $sql) or die($gameerror . "MR-Q01"); + $num = mysqli_num_rows($result); + + $i = 0; + + while ($i < $num) { + + $row = mysqli_fetch_assoc($result); + + $from_id = $row['from']; + $time = $row['time']; + $body = $row['body']; + + $sql = "SELECT `name` FROM `character` WHERE `id` = '$from_id'"; + $resultchar = mysqli_query($mysqli, $sql) or die($gameerror . "MR-Q02"); + $rowchar = mysqli_fetch_assoc($resultchar); + $from_name = $rowchar['name']; + + echo "

Message from $from_name: ($time)
+ $body + +

 "; + + $i++; + + } + +echo ""; + +} else { echo $gameseserr; } // Not logged in + +mysqli_close($mysqli); + +echo $footer; + +?> + + diff --git a/website/game/msg-send.php b/website/game/msg-send.php new file mode 100644 index 0000000..6a95073 --- /dev/null +++ b/website/game/msg-send.php @@ -0,0 +1,68 @@ + +Frontier II + + + +

CommLink

+

Transmitting...

"; + + $isquick = $_POST['QUICK']; + $unsafe_body = $_POST['BODY']; + $from = $_SESSION['cid']; + $date = date('Y-m-d H:i'); + $i = 0; + + $body = htmlentities(strip_tags(mysqli_real_escape_string($mysqli, $unsafe_body))); + + if ($isquick == 'TRUE') { // QuickNote (all players) + + $sql = "SELECT * FROM `character`"; + $result = mysqli_query($mysqli, $sql) or die($gameerror . "MS-Q01"); + $num = mysqli_num_rows($result); + + while ($i < $num) { + + $row = mysqli_fetch_assoc($result); + $cid = $row['id']; + + $sql = "INSERT INTO message SET + message.from = '$from', + message.to = '$cid', + message.flags = '0', + message.time = '$date', + message.body = '$body'"; + + mysqli_query($mysqli, $sql) or die($gameerror . "MS-Q02"); + + $i++; + + } + + // More complicated message types will go here + + } + + if ($i > 0) { + echo "Transmission complete. $i messages sent."; + } else { + echo "Transmission error - no recipients found."; + } + + echo ""; + +} else { echo $gameseserr; } // Not logged in + +mysqli_close($mysqli); + +echo $footer; + +?> + + diff --git a/website/game/msg.php b/website/game/msg.php new file mode 100644 index 0000000..99485d2 --- /dev/null +++ b/website/game/msg.php @@ -0,0 +1,61 @@ + +Frontier II + + + + +

CommLink

+ +

Incoming Messages

"; + + $character_id = $_SESSION['cid']; + + // Pull list of messages first + $sql = "SELECT `id` FROM `message` WHERE `to` = '$character_id'"; + $result = mysqli_query($mysqli, $sql) or die($gameerror . "M-Q01"); + + $num = mysqli_num_rows($result); + + if ($num > 0) { // You've Got Mail! + + echo "

$num messages.
+

+ +
+ "; + + } else { // No mail found + + echo "

No messages."; + + } + + // Here should be a link to the long compose screen. + + // Quick way to send note to all players. + + echo " +

QuickNote

+

+ +
+
+ "; + +} else { echo $gameseserr; } // Not logged in + +mysqli_close($mysqli); + +echo $footer; + +?> + +