Upload files to "website/game"

This commit is contained in:
Justin Pope 2024-09-19 03:04:58 +00:00
parent fbd9b1cd5d
commit c73cf5e65c
3 changed files with 196 additions and 0 deletions

67
website/game/msg-read.php Normal file
View file

@ -0,0 +1,67 @@
<HTML><HEAD>
<TITLE>Frontier II</TITLE>
</HEAD><BODY BGCOLOR="#000000" TEXT="#f0f0f0">
<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/include.php');
if ($_SESSION['cid'] != '')
{ // Logged in
echo "<TABLE ALIGN=\"CENTER\" VALIGN=\"CENTER\" WIDTH=\"90%\" HEIGHT=\"90%\" BORDER=\"0\">
<TR><TD><H2 ALIGN=\"CENTER\">CommLink</H2></TD></TR>";
$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 "<TR><TD><P><B>Message from $from_name:</B> ($time)<BR>
$body
</TD></TR>
<TR><TD><P>&nbsp;</TD></TR>";
$i++;
}
echo "</TABLE>";
} else { echo $gameseserr; } // Not logged in
mysqli_close($mysqli);
echo $footer;
?>
</BODY></HTML>

68
website/game/msg-send.php Normal file
View file

@ -0,0 +1,68 @@
<HTML><HEAD>
<TITLE>Frontier II</TITLE>
</HEAD><BODY BGCOLOR="#000000" TEXT="#f0f0f0">
<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/include.php');
if ($_SESSION['cid'] != '') { // Logged in
echo "<TABLE ALIGN=\"CENTER\" VALIGN=\"CENTER\" WIDTH=\"90%\" HEIGHT=\"90%\" BORDER=\"0\">
<TR><TD><H2 ALIGN=\"CENTER\">CommLink</H2></TD></TR>
<TR><TD><P>Transmitting...<P>";
$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 "</TD></TR></TABLE>";
} else { echo $gameseserr; } // Not logged in
mysqli_close($mysqli);
echo $footer;
?>
</BODY></HTML>

61
website/game/msg.php Normal file
View file

@ -0,0 +1,61 @@
<HTML><HEAD>
<TITLE>Frontier II</TITLE>
</HEAD><BODY BGCOLOR="#000000" TEXT="#f0f0f0">
<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/include.php');
if ($_SESSION['cid'] != '')
{ // Logged in
echo "<TABLE ALIGN=\"CENTER\" VALIGN=\"CENTER\" WIDTH=\"90%\" HEIGHT=\"90%\" BORDER=\"0\">
<TR><TD><H2 ALIGN=\"CENTER\">CommLink</H2></TD></TR>
<TR><TD>
<H3>Incoming Messages</H3>";
$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 "<P>$num messages.<BR>
<FORM ACTION=\"msg-read.php\" METHOD=\"POST\">
<INPUT TYPE=\"HIDDEN\" NAME=\"SHOW\" VALUE=\"ALL\">
<INPUT TYPE=\"SUBMIT\" VALUE=\"Read All\"></FORM>
";
} else { // No mail found
echo "<P>No messages.";
}
// Here should be a link to the long compose screen.
// Quick way to send note to all players.
echo "</TD></TR><TR><TD>
<P><H3>QuickNote</H3>
<P><FORM ACTION=\"msg-send.php\" METHOD=\"POST\">
<INPUT TYPE=\"HIDDEN\" NAME=\"QUICK\" VALUE=\"TRUE\">
<TEXTAREA NAME=\"BODY\" ROWS=\"10\" COLS=\"50\"></TEXTAREA><BR>
<INPUT TYPE=\"SUBMIT\" VALUE=\"Send\"></FORM>
</TD></TR></TABLE>";
} else { echo $gameseserr; } // Not logged in
mysqli_close($mysqli);
echo $footer;
?>
</BODY></HTML>