<?php
/****************************************************************************
* Copyright (C) 2000 Bryan Brunton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/
page_open(array("sess" => "ME_Session_Uncached", "auth" => "ME_Auth", "user" => "ME_User"));
include("./merchantempiresdefines.php");
?>
<html><head><title>Merchant Empires: Enter New Player</title>
<link rel=stylesheet href="./merchantempires.css" type=text/css>
</head><body text=white background="./images/createbg.gif"><?php
include("./templates/header.html");
$error = 0;
## Get a database connection
$db = new ME_DB;
// Check if there was a submission
while (is_array($HTTP_POST_VARS)
&& list($key, $val) = each($HTTP_POST_VARS)) {
switch ($key) {
case "join":
if (empty($game_id)) {
$error = "Error. No game id submitted.";
break;
}
}
}
?>
<table BORDER=0 WIDTH='100%' NOSAVE >
<tr>
<td width=100 vAlign=top><?php
$db = new ME_DB_Xml;
$db->add_parameter("time", date ("Y H:i:s"));
echo $db->get_transform("./xslt/mainmenu_small.xslt", "");
?>
<td width=350 align=left vAlign=top><?php
if ( $error ) {
$db = new ME_DB_Xml;
$db->add_parameter("title", "Error");
$db->add_parameter("message", $error);
echo $db->get_transform("./xslt/message_box.xslt", "");
} else {
?>
<table border=0 cellPadding=5 cellSpacing=0 height="100%" width="100%">
<td bgColor=#000000 vAlign=top width="100%">
<table border=0 cellPadding=0 cellSpacing=0 width=450>
<tr>
<td bgColor=#993300>
<table border=0 cellPadding=5 cellSpacing=1 width="100%">
<tr>
<td bgColor=#330000><FONT color=#ffffff face=arial,helvetica,swiss size=4><B>Create a Merchant
</B></FONT><BR clear=all></td>
</tr>
<tr>
<td bgColor=#000000><FONT color=#cccccc face=arial,helvetica,swiss size=2>
<form METHOD="POST" ACTION=<?php
$sess->purl(URL . "create_player.php");
?> >
<table>
<tr>
<td align=left valign=top> </td>
<td><FONT color=#cccccc face=arial,helvetica,swiss size=3>Each Merchant Empires
game requires you to create a new Merchant. Enter a name for your Merchant
and select a race.</font><br><br></td>
</tr>
<tr>
<td align=left>Merchant name:</td>
<td><INPUT TYPE="textbox" NAME="name"></td>
</tr>
<tr>
<td align=left>Race:</td>
<td><SELECT NAME="race" SIZE=1><?php
$db = new ME_DB;
$query = sprintf("SELECT * from games where game_id = '%s'", $game_id);
$db->query($query);
$db->next_record();
$active_races = array();
$active_races = explode(",", $db->f("active_races"));
for ($i = 0; $i <= count($active_races) - 1; $i++) {
echo "<option value=" . $db->f("namerace_" . $active_races[$i]) . ">" . $db->f("namerace_" . $active_races[$i]) . "</option>";
}
?>
</SELECT><BR></td>
</tr>
<tr>
<td><INPUT TYPE="hidden" NAME="game_id" VALUE=<?php
printf("%s", $game_id);
?> >
</td>
<td><INPUT TYPE="submit" NAME="create" VALUE="Create"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table><BR>
</td>
</table>
<?php
}
?>
</td></tr></table>
</body></html><?php
page_close();
?>