2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/team.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
|
|
|
|
db_init();
|
|
|
|
|
2003-03-19 21:01:32 +00:00
|
|
|
$user = get_logged_in_user();
|
2003-03-21 04:38:55 +00:00
|
|
|
if (!strlen($_POST["name"])) {
|
2003-03-19 21:01:32 +00:00
|
|
|
page_head("Error");
|
|
|
|
echo "You must specify a name for your team.";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
$query = sprintf(
|
|
|
|
"insert into team (userid, create_time, name, name_lc, url, type, name_html, description, country, nusers) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d)",
|
|
|
|
$user->id,
|
|
|
|
time(),
|
2003-03-21 04:38:55 +00:00
|
|
|
$_POST["name"],
|
|
|
|
strtolower($_POST["name"]),
|
|
|
|
$_POST["url"],
|
|
|
|
$_POST["type"],
|
|
|
|
$_POST["name_html"],
|
|
|
|
$_POST["description"],
|
|
|
|
$_POST["country"],
|
2003-05-20 22:20:08 +00:00
|
|
|
0
|
2003-03-19 21:01:32 +00:00
|
|
|
);
|
2003-01-03 21:55:05 +00:00
|
|
|
|
2003-03-19 21:01:32 +00:00
|
|
|
$result = mysql_query($query);
|
|
|
|
if ($result) {
|
2003-03-21 04:38:55 +00:00
|
|
|
$teamid = mysql_insert_id();
|
2003-05-20 22:20:08 +00:00
|
|
|
$team_result = mysql_query("select * from team where id = $teamid");
|
|
|
|
$new_team = mysql_fetch_object($team_result);
|
|
|
|
mysql_free_result($team_result);
|
2004-11-21 18:56:30 +00:00
|
|
|
user_join_team($new_team, $user);
|
2003-03-31 23:18:55 +00:00
|
|
|
Header("Location: team_display.php?teamid=$teamid");
|
2003-03-19 21:01:32 +00:00
|
|
|
} else {
|
|
|
|
page_head("Error");
|
|
|
|
echo "Couldn't create team - please try later.<br>\n";
|
|
|
|
echo "You may need to try a different team name.\n";
|
|
|
|
page_tail();
|
2003-01-30 23:03:52 +00:00
|
|
|
}
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|