Location: PHPKode > projects > PhpInv > phpInv-0.8.0/admin/inc/group_delete.php
<?

// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 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 General Public License for
// more details.

// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA.

// Copyright: (C) 2002/2003 Stefan Cyris 


if (isset($confirm)) {
	// do not delete guest or admin
	if ($id > 2) {	// 1: Guest group, 2: Admin group   <-- dont delete them
		$result = $DB->query("DELETE FROM ".$DB->tableprefix."usergroup WHERE usergroupid='".str_prepare($id)."'");
		if ($result) {
			$successurl = $url."?hash=".$hash;
			print "<html><head><meta http-equiv=\"refresh\" content=\"$refresh; URL=$successurl\">";
			print "</head><body><a href=\"$successurl\">Success!</a></body></html>";
		}
		$DB->free_result($result);
        } else {
	        $errortext = "Error: Do not delete Admin or Guest\n";
		print $errortext;
	}
} else {
	?>
	<form method="POST" acion="group.php">
	<table width="100%">
		<tr><th>
			Delete Group
		</th></tr>
		<tr>
		<td>
		Really delete ?
		</td>
		</tr><tr><td>
		<input type="hidden" name="action" value="delete">
		<input type="hidden" name="id" value="<? print $id ?>">
		<input type="hidden" name="hash" value="<? print $hash ?>">
		<input type="Submit" name="confirm" value="Yes">
		<input type="Submit" name="noconfirm" value="No">
		</td></tr>
	</table>
	</form>
	<?
}

?>
Return current item: PhpInv