& Matías Parodi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ## /* It doesn't work for now, need to be finished. */ if (!defined("SECURITY")) { exit; } if ($_SESSION['LOGIN'] !== true) header("Location: {$base}home"); if ($_POST) { $sql = "SELECT `groups`.`id_owner` FROM `groups` WHERE (`groups`.`id_owner` = '" . $_SESSION['ID_USER'] . "');"; mysql_query($sql); if (mysql_affected_rows() <= 5) { $name = safe_str($_POST['name'], true); $desc = safe_str($_POST['desc'], true); if ($_POST['type'] == 'public') { $type = 'public'; } elseif ($_POST['type'] == 'private') { $type = 'private'; } else { $type = 'public'; } if (strlen($name) > 30) echo _('El nombre del grupo no puede exceder de 30 caracteres'); if (strlen($desc) > 140) echo _('La descripción del grupo no puede exceder de 140 caracteres'); if (strlen($name) > 30 and strlen($desc) > 140) echo _('El nombre del grupo no puede exceder de 30 caracteres, ni la descripción de 140 caracteres'); $sql = "SELECT `groups`.`name` FROM `groups` WHERE name='" . $name . "';"; $result = mysql_query($sql); if (mysql_affected_rows() == 0) { $sql = "INSERT INTO `groups` (`id_owner`, `name`, `description`, `type`) values ('" . $_SESSION['ID_USER'] . "', '" . $name . "', '" . $desc . "', '" . $type . "');"; mysql_query($sql); $sql = "SELECT `groups`.`id_group` FROM `groups` WHERE name='" . $name . "';"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); mysql_free_result($result); $sql = "INSERT INTO `suscriptions` (`id_group`, `id_user`, `level`) values ('" . $row['id_group'] . "', '" . $_SESSION['ID_USER'] . "', 'admin');"; mysql_query($sql); header('Location: ' . $_SERVER['HTTP_REFERER']); } else { $err = _('El nombre del grupo ya está ocupado'); } } else { $err = _('Has superado el límite de creación de grupos'); } } ?>







Un usuario podrá crear, como máximo, 5 grupos, y tú tienes .