<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<html>
	<head>
		<title>Pegasus Installation</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >	
		<link href="css/install.css" rel="stylesheet" type="text/css">

		<script  src="js/jquery-3.4.1.min.js" ></script>
  		<script src="js/app.js" ></script>
	</head>	
	<body style="align:center">
	
	<?php
		require_once('../install/dictionary.php');
		require_once('../install/functions.php');
		

		// $_REQUEST['ftp_user'] = '';
		// $_REQUEST['ftp_pass'] = '';
		// $_REQUEST['ftp_port'] = '';
		// $_REQUEST['sftp'] = '';
		// $_REQUEST['passv'] = '';
		// $_REQUEST['upd_rcopy'] = '';
		// $_REQUEST['ftp_path'] = '';
		// $_REQUEST['mysql_host'] = '';
		// $_REQUEST['mysql_db'] = '';
		// $_REQUEST['mysql_user'] = '';
		// $_REQUEST['mysql_pass'] = '';
		// $_REQUEST['mysql_port'] = '';
		// $_REQUEST['tesae_user'] = '';
		// $_REQUEST['tesae_pass'] = '';


		// require_once('../install/install_01.php');	
		// return ;
		
		$prob_message = '';
		$prob_message_ftp   = '';
		$prob_message_mysql = '';
		$prob_message_tesae = '';
		
		$islocl = 0;
		if(!empty($_REQUEST['islocl']))
			$islocl = 1;
		
		
	   if(isset($_REQUEST['install']) && $_REQUEST['install'] ==1 ){
		

			$prob_message_res = install_validate_hosting_requirements(); 
			if($prob_message_res['ok'] === 0){
				$prob_message = $prob_message_res['msg'] ;
				$prob_message00 = $prob_message_res['msg'] ;
			}else{
				//check ftp
				if($_REQUEST['upd_rcopy']==0 and !install_check_ftp_connect()){
					$prob_message     = $dic['params_problem'];
					$prob_message_ftp = $dic['params_ftp_problem'];
				}	
				
				//check mysql
				if(!install_check_mysql_connect($_REQUEST['islocl'])){
					$prob_message     = $dic['params_problem'];
					$prob_message_mysql = $dic['params_mysql_problem'];
				}
				
				//check tesae
				//if(!install_check_tesae_connect()){
				//	$prob_message     = $dic['params_problem'];
				//	$prob_message_tesae = $dic['params_tesae_problem'];
				//}
			}


			
			
			if($prob_message==''){
				require_once('../install/install_01.php');	
			}else{
				require_once('../install/install_00.php');	
			}
			
		}else{
			
			require_once('../install/install_00.php');	
		
		} 
		
		
	?> 
	</body>
</html>
