<?php
include ("config.php");
?>
<form method="post" action=""><br />
<table align="center" width="90%" cellpadding="1" cellspacing="1" id="textove">
<tr>
<td align="left"><p class="margin">Име на отбора: </p></td>
<td align="left"><input name="team_name" type="text" id="team_name" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">Играч #1: </p></td>
<td align="left"><input name="player1" type="text" id="player1" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">Играч #2: </p></td>
<td align="left"><input name="player2" type="text" id="player2" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">Играч #3: </p></td>
<td align="left"><input name="player3" type="text" id="player3" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">Играч #4: </p></td>
<td align="left"><input name="player4" type="text" id="player4" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">Играч #5: </p></td>
<td align="left"><input name="player5" type="text" id="player5" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">SteamID Player #1: </p></td>
<td align="left"><input name="steam_player1" type="text" id="steam_player1" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">SteamID Player #2: </p></td>
<td align="left"><input name="steam_player2" type="text" id="steam_player2" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">SteamID Player #3: </p></td>
<td align="left"><input name="steam_player3" type="text" id="steam_player3" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">SteamID Player #4: </p></td>
<td align="left"><input name="steam_player4" type="text" id="steam_player4" size="15" /></td>
</tr>
<tr>
<td align="left"><p class="margin">SteamID Player #5: </p></td>
<td align="left"><input name="steam_player5" type="text" id="steam_player5" size="15" /></td>
</tr>
<tr>
<td align="center"><a href="rules.php">Прочети правилата на турнира</a></td>
</tr>
<tr>
<td colspan="3" align="center">
<input name="submit" type="submit" id="button" value="Добави!"/>
<input name="reset" type="reset" id="button" value="Изчисти"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit'])){
$team_name = htmlspecialchars($_POST['team_name']); //име на отбора
$player1 = htmlspecialchars($_POST['player1']); //играч 1
$player2 = htmlspecialchars($_POST['player2']); //играч 2
$player3 = htmlspecialchars($_POST['player3']); //играч 3
$player4 = htmlspecialchars($_POST['player4']); //играч 4
$player5 = htmlspecialchars($_POST['player5']); //играч 5
$steam_player1 = htmlspecialchars($_POST['steam_player1']); //steam играч 1
$steam_player2 = htmlspecialchars($_POST['steam_player2']); //steam играч 2
$steam_player3 = htmlspecialchars($_POST['steam_player3']); //steam играч 3
$steam_player4 = htmlspecialchars($_POST['steam_player4']); //steam играч 4
$steam_player5 = htmlspecialchars($_POST['steam_player5']); //steam играч 5
$odoboren = "0";
$sql = mysql_query("INSERT INTO `cs_teams` (`id`,`team_name`, `player1`, `player2`, `player3`, `player4`, `player5`, `steam_player1`, `steam_player2`, `steam_player3`, `steam_player4`, `steam_player5`, `odobren`) VALUES (NULL, '$team_name', '$player1', '$player2', '$player3', '$player4', '$player5', '$steam_player1', '$steam_player2', '$steam_player3', '$steam_player4', '$steam_player5', '$odobren');") or die(mysql_error();
if($sql == true){
echo '<meta http-equiv="refresh" content="1;url=index.php">';
echo "Отбора е успешно регистриран!<br />Трябва да изчакате администратора на сайта да одобри вашият отбор!";
}
else {
echo "Отбора не е добавен!";
}}}
?>