Location: PHPKode > projects > Hosting App > hosting/delete.php
<?php
////////////////////////////////////////////////////////////////////////////////
//   Copyright (c), 2002, Sadri Sahraoui <hide@address.com>               //
//   Hosting App - A web based hosting management system                      //
//   http://sf.net/projetcs/hostingapp/                                       //
//   				                                                                  //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of the GNU General Public License                     //
//                                                                            //
//   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 GNU General Public License            //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////

/**
 *
 * @version v1, 19/09/2002
 */

session_start();

define('MX_GENERAL_PATH', 'config/');  			// path to Mxconf.php

define('MX_ERROR_PATH', 'modules/Mx/');    	// path to ErrorManager.php

require("./config/config.inc.php");

	$tpl = new ModeliXe("admin/main.mxt", session_name()."=".session_id()); // Instantiation of Modelixe Class

	$tpl -> SetModeliXe();

	$tpl -> SetMxLang("./lang/index.lang.".$lang); //set default langage

	$tpl -> MxText('title', $app_name." ".$app_version); // Title 

	$tpl -> MxBloc('header', 'modify', './tpl/admin/header.mxt'); //header 

	$tpl -> MxBloc('body', 'modify', './tpl/admin/body.mxt');	 //body

		// display warning message 

		if (isset($HTTP_GET_VARS['what'])) {

		    switch($HTTP_GET_VARS['what']){

		    	case "user": 

	 				  $tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.users.mxt');

						build_subUsers(& $tpl);

		    		$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/del_confirm.mxt');

						$tpl -> MxText('body.main_bloc.what', $HTTP_GET_VARS['what']." : ".$HTTP_GET_VARS['user']);

						$tpl -> MxText('body.main_bloc.message', "By deleting this user, all associated domains and email address's will be deleted.");

						$tpl -> MxFormField('body.main_bloc.back', "submit", "submit", "No Back", "onClick='javascript:history.go(-1);'");

						$tpl -> MxFormField('body.main_bloc.delete', "submit", "submit", "Yes Delete");

						$tpl -> MxHidden('body.main_bloc.id', "id=".$HTTP_GET_VARS['id']);				

						$tpl -> MxHidden('body.main_bloc.what', "what=".$HTTP_GET_VARS['what']);

						$tpl -> MxHidden('body.main_bloc.q', "delete=yes");

		    		break;

		    	case "domain":

						$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.domains.mxt');

						build_subDomains(& $tpl);

		    		$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/del_confirm.mxt');

						$tpl -> MxText('body.main_bloc.what', $HTTP_GET_VARS['what']." : ".$HTTP_GET_VARS['domain']);

						$tpl -> MxText('body.main_bloc.message', "By deleting this domain, all associated email will be deleted.");

						$tpl -> MxFormField('body.main_bloc.back', "submit", "submit", "No Back", "onClick='javascript:history.go(-1);'");

						$tpl -> MxFormField('body.main_bloc.delete', "submit", "submit", "Yes Delete");

						$tpl -> MxHidden('body.main_bloc.id', "id=".$HTTP_GET_VARS['id']);				

						$tpl -> MxHidden('body.main_bloc.what', "what=".$HTTP_GET_VARS['what']);

						$tpl -> MxHidden('body.main_bloc.q', "delete=yes");

						break;
		    } // switch
		}//endif

		// if user confirm 
		if (isset($HTTP_POST_VARS['delete'])) {

		    switch($HTTP_POST_VARS['what']){ //

		    	case "user": 
	 				  $tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.users.mxt');
						build_subUsers(& $tpl);
	    			$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/del_confirm.mxt');					
						remove_user($tpl, $HTTP_POST_VARS['id']);
						break;

		    	case "domain": 
	 				  $tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.domains.mxt');
						build_subDomains(& $tpl);					
						$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/del_confirm.mxt');
		    		delete_domain($HTTP_POST_VARS['id']);
						delete_email($HTTP_POST_VARS['id']);
						$tpl -> MxText ('body.main_bloc.message', "Domain and related data are successfully deleted");
		    		break;

		    	case "product":
		    		;
						break;
		    } // switch
		}//endif

switch($HTTP_SERVER_VARS['REQUEST_METHOD']){

	case "GET": 
		$tpl -> MxImage('body.cat_img', "img/".$HTTP_GET_VARS['what']."s.1.gif");
		break;
		
	case "POST": 
		$tpl -> MxImage('body.cat_img', "img/".$HTTP_POST_VARS['what']."s.1.gif");
		break;

	default:
		$tpl -> MxImage('body.cat_img', "img/".$HTTP_GET_VARS['what']."s.1.gif");
} // switch 

	$tpl -> MxBloc('footer', 'modify', './tpl/admin/footer.mxt');
	
	$tpl -> MxWrite();		

?>
Return current item: Hosting App