2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
|
|
|
|
2006-01-13 01:07:05 +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
|
|
|
|
2006-01-13 01:07:05 +00:00
|
|
|
db_init();
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2006-01-13 01:07:05 +00:00
|
|
|
$user = get_logged_in_user();
|
|
|
|
|
|
|
|
$name = process_user_text(strip_tags(post_str("name")));
|
|
|
|
if (strlen($name) == 0) {
|
|
|
|
error_page("Must set team name");
|
|
|
|
}
|
|
|
|
$name_lc = strtolower($name);
|
|
|
|
$url = process_user_text(strip_tags(post_str("url", true)));
|
|
|
|
if (strstr($url, "http://")) {
|
|
|
|
$url = substr($url, 7);
|
|
|
|
}
|
|
|
|
$type = process_user_text(strip_tags(post_str("type", true)));
|
2006-02-01 20:19:51 +00:00
|
|
|
if (!is_valid_team_type($type)) {
|
|
|
|
$type = 'None';
|
|
|
|
}
|
|
|
|
|
2006-01-13 01:07:05 +00:00
|
|
|
$name_html = process_user_text(post_str("name_html", true));
|
|
|
|
$description = process_user_text(post_str("description", true));
|
|
|
|
$country = process_user_text(post_str("country", true));
|
|
|
|
|
2006-02-01 20:19:51 +00:00
|
|
|
if (!is_valid_country($country)) {
|
|
|
|
$country = 'None';
|
|
|
|
}
|
|
|
|
|
2006-01-13 01:07:05 +00:00
|
|
|
$query = sprintf(
|
|
|
|
"insert into team (userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
|
|
|
|
$user->id,
|
|
|
|
time(),
|
|
|
|
$name,
|
|
|
|
$name_lc,
|
|
|
|
$url,
|
|
|
|
$type,
|
|
|
|
$name_html,
|
|
|
|
$description,
|
|
|
|
$country,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
|
|
|
$result = mysql_query($query);
|
|
|
|
if ($result) {
|
|
|
|
$teamid = mysql_insert_id();
|
|
|
|
$team_result = mysql_query("select * from team where id = $teamid");
|
|
|
|
$new_team = mysql_fetch_object($team_result);
|
|
|
|
mysql_free_result($team_result);
|
|
|
|
user_join_team($new_team, $user);
|
|
|
|
Header("Location: team_display.php?teamid=$teamid");
|
|
|
|
} else {
|
|
|
|
error_page("Could not create team - please try later. <br>" .
|
|
|
|
"You may need to try a diffrent team name."
|
2003-03-19 21:01:32 +00:00
|
|
|
);
|
2006-01-13 01:07:05 +00:00
|
|
|
}
|
2003-01-03 21:55:05 +00:00
|
|
|
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|