* 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, see <http://www.gnu.org/licenses/>.
 */
include_once 'hndl/common.php';
include_once 'inc/game.php';
include_once 'inc/msg_functions.php';
$return_vars['page'] = 'alliance';
do {
    // Dummy Loop
    if (ALLIANCE_MESSAGE_TURN_COST > $spacegame['player']['turns']) {
        $return_codes[] = 1018;
        break;
    }
    if (!isset($_REQUEST['alliance']) || !validate_alliancename($_REQUEST['alliance'])) {
        $return_codes[] = 1080;
        break;
    }
    if (!isset($_REQUEST['message'])) {
        $return_codes[] = 1136;
        break;
    }
    $len = strlen($_REQUEST['message']);
    if ($len <= 0) {
        $return_codes[] = 1136;
        break;
    }
    if ($len > MAXIMUM_MESSAGE_LENGTH) {
        $return_codes[] = 1149;
        break;
 */
include_once 'hndl/common.php';
include_once 'inc/alliance.php';
$return_vars['page'] = 'create';
do {
    // Dummy Loop
    if ($spacegame['player']['alliance'] > 0) {
        $return_codes[] = 1082;
        break;
    }
    if (!isset($_REQUEST['name'])) {
        $return_codes[] = 1080;
        break;
    }
    $name = $_REQUEST['name'];
    if (!validate_alliancename($name)) {
        $return_codes[] = 1080;
        break;
    }
    if (trim(str_replace('  ', ' ', $name)) != $name) {
        $return_codes[] = 1081;
        break;
    }
    $db = isset($db) ? $db : new DB();
    $player_id = PLAYER_ID;
    $tax_mult = 1.0 + ceil(100 * ALLIANCE_START_TAX + ALLIANCE_MEMBER_TAX) / 100;
    $rs = $db->get_db()->query("select * from alliances where lower(caption) = '" . strtolower($name) . "'");
    $rs->data_seek(0);
    if ($row = $rs->fetch_assoc()) {
        $return_codes[] = 1083;
        break;
 * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 */
include_once 'tmpl/common.php';
define('SENT_MSG_TYPE', 2);
include_once 'inc/messages.php';
$name = '';
if (isset($_REQUEST['name']) && validate_alliancename($_REQUEST['name'])) {
    $name = $_REQUEST['name'];
}
?>
<div class="header2">Message Alliance</div>
<div class="docs_text">
	Sends a message to an <a href="alliance.php?page=list">alliance</a> by name. All
	members of the alliance will receive the message.
</div>
<div class="docs_text">
	<form action="handler.php" method="post">
		<table class="message">
			<tr class="message">
				<td class="message">Alliance:</td>
				<td class="message"><input class="msg_form_input" type="text" name="alliance" value="<?php 
echo $name;