Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/mmishra/erp19-7-2019/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/erp19-7-2019/inner.php
<?php
if (isset($_SERVER['PATH_INFO'])) {
	$url 						= explode('/', $_SERVER['PATH_INFO']);
	// incoming request format /app/menu/action/tuple
	// app is application MVC to be invoked
	// menu is View method to be called
	// action is Controller action to be performed
	// tuple is record ID of Model for Controller action
	list($root, $app, $menu, $action, $tuple) = array_slice($url, 0, 5);
	$params						= array_slice($url, 5);	// rest of the elements

	//foreach ($params as $p) {
		//echo $p. ', ';
	//}
	// Initiate the appropriate controller and render the required view
    // Check if controller exists. NB: it is needed to check for model and view too
    
	if ($app != 'erp') {
		// include parent classes so that classes can extend them
		require_once(__DIR__ .'/models/erp_model.php');
		require_once(__DIR__ .'/controllers/erp_controller.php');
		require_once(__DIR__ .'/views/erp_view.php');
	}
    $appModel 					= __DIR__ .'/models/' .$app. '_model.php';
    $appController 				= __DIR__ .'/controllers/' .$app. '_controller.php';
    $appView 					= __DIR__ .'/views/' .$app. '_view.php';

    if (file_exists($appController) && file_exists($appModel) && file_exists($appView)) {
        require_once($appModel);
        require_once($appController);
        require_once($appView);

        $modelName      		= $app. 'Model';
        $controllerName 		= $app. 'Controller';
        $viewName       		= $app. 'View';

        $appModel       		= new $modelName();
        $appController  		= new $controllerName($appModel);
        $appView        		= new $viewName($appController, $appModel);

		// set controllers appID and menuID
		$appController->app 	= $app;
		$appController->menu 	= $menu;
		$appController->action 	= $action;
		$appController->tuple 	= intval($tuple);
		$appController->params	= $params;
        $viewMethod 			= $app.ucwords($menu); // first and second parameter

		//foreach ($params as $p) {
		//	echo $p.'-';
		//}
		// This is the requirements of ERP Framework 
		if ($_SESSION["loginID"] && empty($_SESSION["sessionID"])) {
			//echo '<script type="text/javascript">alert("Session Over! Re-login Please."); window.location="/";</script>';
			session_destroy();
			header("Location: /", true, 'Login');
		} else if ($appController->checkProtection($menu) == TRUE && empty($_SESSION["sessionID"])) {
			header("Location: /", true, 'Login');
		}
		//header('WWW-Authenticate: Negotiate');//header('WWW-Authenticate: NTLM', false);//

		$header = "<html><head>
	    <base href='https://erp.iiita.ac.in/' />
		<link rel='stylesheet' type='text/css' href='css/erp_style.css' media='screen' />
		<link rel='stylesheet' type='text/css' href='css/fontawesome-all.css' media='screen' integrity='sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ' crossorigin='anonymous' />

		<script type='text/javascript' src='js/erp_ajax.js'></script>
		<script type='text/javascript' src='js/fontawesome-all.js'></script>
		<script type='text/javascript' src='js/jquery.min.js'></script>
		</head><body aaaa>
		<script type='text/javascript' src='js/erp_body.js'></script>";
		$footer = "</body></html>";
		
       	if ($action == 'render') {
			switch ($menu) {
				case 'helper':
					// render only modulebar
					print $appView->erpHelper($tuple);
					break;
				default:
					print $appView->erpError("<h1>ERP detects unsupported menu [ $menu ].");
			}
    	} else if (in_array($menu, ['photograph']) || in_array($action, ['dataUpload', 'signUpload', 'photoUpload', 'docUpload', 'photosUpload', 'photosupload', 'exemption'])) {
            // iframe loading
	        print $header;
	        print "<form id='erpForm' name='erpForm' method='POST' action='inner/$app/$menu/$action/$tuple/" .$params[0]. '/' .$params[1]. "' enctype='multipart/form-data'>";
			print $appView->$viewMethod($action, $tuple); 		// third and fourth parameter   
			print "</form>";
			print $footer;			
    	} else { // content div loading
			if (in_array($action, ['update', 'save', 'delete'])) {
				$userACL = $appModel->getUserACL($menu);
				list($insert, $update, $delete) = explode(',', $userACL);
				if ($action == 'save' && $insert) {				// go ahead
				} else if ($action == 'save' && $update) {		// go ahead
				} else if ($action == 'delete' && $delete) {	// go ahead
				} else {
					header("Location: /");
				}
			} // call the target method via the view, it's a dynamic call of view
	        print $appView->$viewMethod($action, $tuple); // third and fourth parameter 		
		}
    } else {
		print "<h1>ERP detects unsupported controller [ $app ].</h1>";
	}    
} else {
	print "<h1>ERP detects unsupported URL: " .$_SERVER['PATH_INFO']. "</h1>";
}

?>



ZeroDay Forums Mini