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();
|
2005-05-12 21:33:18 +00:00
|
|
|
|
|
|
|
$name = process_user_text(strip_tags(post_str("name")));
|
|
|
|
if (strlen($name) == 0) {
|
|
|
|
error_page("Must set team name");
|
2003-03-19 21:01:32 +00:00
|
|
|
}
|
2005-05-12 21:33:18 +00:00
|
|
|
$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)));
|
|
|
|
$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));
|
|
|
|
|
2003-03-19 21:01:32 +00:00
|
|
|
$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(),
|
2005-05-12 21:33:18 +00:00
|
|
|
$name,
|
|
|
|
$name_lc,
|
|
|
|
$url,
|
|
|
|
$type,
|
|
|
|
$name_html,
|
|
|
|
$description,
|
|
|
|
$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 {
|
2005-05-12 21:33:18 +00:00
|
|
|
error_page("Could not create team - please try later. <br>" .
|
|
|
|
"You may need to try a diffrent team name.");
|
2003-01-30 23:03:52 +00:00
|
|
|
}
|
2002-08-07 18:56:55 +00:00
|
|
|
?>
|