Esempio n. 1
0
/**
 *  Action add database
 */
if ($action == 'add') {
	if ($caneditperms) {
		$message = "";
		if (!$_POST["nom"]) {
			$message = '<div class="error">' . $langs->trans("NameNotDefined") . '</div>';
			$action = "create"; // Go back to create page
		}

		if (!$message) {
			try {
				$object->id = trim($_POST["nom"]);
				$object->create();
			} catch (Exception $e) {
				$langs->load("errors");
				$message = '<div class="error">' . $langs->trans("ErrorDatabaseAlreadyExists", $object->id) . '</div>';
				$action = "create"; // Go back to create page
			}
			Header("Location: fiche.php?id=" . $object->id);
			exit;
		}
	} else {
		$langs->load("errors");
		$message = '<div class="error">' . $langs->trans('ErrorForbidden') . '</div>';
	}
}

// Add/Remove user into group