frontier/website/saveuser.php

54 lines
1.3 KiB
PHP

<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/include.php');
if ($_SESSION['id'] != '')
{ // Logged in
$id = $_SESSION['id'];
$safe_email = $_POST['safe_email'];
$pub_email = $_POST['pub_email'];
$note = $_POST['note'];
if (($safe_email != ''))
{ // Required elements present
$sql = "UPDATE player SET safe_email = '$safe_email',
pub_email = '$pub_email', note = '$note'
WHERE id = '$id'";
mysqli_query($mysqli, $sql) or die($gameerror . "SU-Q01");
header("Location: $gameroot/playuser.php");
} else { // Required elements not present
echo "<HTML><HEAD><TITLE>Frontier II</TITLE>
</HEAD><BODY BGCOLOR=\"#000000\" TEXT=\"#f0f0f0\">
<H2 ALIGN=\"CENTER\">Frontier II</H2>
<P><FONT COLOR=\"RED\">Error!</FONT> It looks like you
left out a required field. Please go to the
<A HREF=\"$gameroot/playuser.php\">player page</A>
and try again.
</BODY></HTML>";
}
} else { // Not logged in
echo "<HTML><HEAD><TITLE>Frontier II</TITLE>
</HEAD><BODY BGCOLOR=\"#000000\" TEXT=\"#f0f0f0\">
<H2 ALIGN=\"CENTER\">Frontier II</H2>
<P><FONT COLOR=\"RED\">ERROR:</FONT> Not authenticated.
<P>Either you did not log in, or your session timed out.
<P>Please <A HREF=\"$gameroot/index.html\">log in</A> again.
</BODY></HTML>";
}
mysqli_close($mysqli);
?>