Location: PHPKode > projects > Netautor Professional > netautor/napro4/admin/install/setup_5.php
<?php
/* +----------------------------------------------------------------------+
   | Netautor Professional Application Server                             |
   +----------------------------------------------------------------------+
   | Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net>      |
   +----------------------------------------------------------------------+
   | This file is subject to license, that is bundled with this package   |
   | in the file LICENSE.TXT, and is available at through the             |
   | world-wide-web at http://www.netautor.com/license/                   |
   |                                                                      |
   | If you did not receive a copy of the license and are unable to       |
   | obtain it through the world-wide-web, please send a note to          |
   | hide@address.com so we can mail you a copy.                      |
   +----------------------------------------------------------------------+
   | Authors: Stefan Rottensteiner <hide@address.com>    |
   |          Marek  Kadziela      <hide@address.com>	      |
   |          Gregor Wollner                                              |
   |          Helli  Kleinhans 											  |
   +----------------------------------------------------------------------+*/

/**
 * Simple check of database connection
 *
 * @author Stefan Rottensteiner
 * @version $Revision: 1.17 $
 */

require_once ('./setup.inc'); 
if (empty($_POST['SETUP_CHECK']))
{
	?><html>
		<body>
			<script language="JavaScript" type="text/javascript">	
			if (parent && parent.frames["setupmain"])
			{
				parent.frames["setupmain"].document.location.href		="setup.php";
				top.main.document.getElementById('f_installation').rows	="*,0,24";
			}
			else
			{
				document.location.href="setup.html"
			}
			</script>
		</body>
		</html><?php 
	exit();
}

if (!function_exists('includeNaPro'))
{
	function includeNaPro($Includes,$Debug=false,$Area='functions',$Extension='fnc')
	{
		return true;
	}
}

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta name="Description" content="<?php echo SOFTWARE_NAME_FULL;?> <?php echo SOFTWARE_VERSION_FULL;?> Setup Test Step 5">
	<title><?php echo SOFTWARE_NAME_FULL; ?> <?php echo SOFTWARE_VERSION_FULL;?> Setup Test Step 5</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="Expires" content="0">
	<meta name="robots" content="noindex,nofollow">
	<link href="../../include/netautor.css" rel="stylesheet" type="text/css" src="../../include/netautor.css">		
</head>
<script language="JavaScript" type="text/javascript">
	function goOn(SiteName,ConfirmText)
	{
		if ((ConfirmText && ConfirmText!="") && (!confirm(ConfirmText))) return;
		document.forms[0].action=SiteName;
		document.forms[0].submit();
	}
	
	function closeMe() {
		if (top.main && top.main.document.getElementById('f_installation') ) top.main.document.getElementById('f_installation').rows='*,0,24';
		else
		 window.close();
	}
	
	parent.frames['SETUP_HEAD'].document.setTitle('<?php echo (strtr($SETUP_LANGUAGE_TEXT['setup_step'],array('%1'=>'5','%2'=>'7')));?>');

</script>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="1" topmargin="1">
<br>
<br>
<table border="0" cellspacing="0" cellpadding="0" align="center" valign="top">
	<form action="setup_5.php" method="post">
	<?php 
	echo(setup_getMyVars($_POST,'NAPRO_START'));
	if (!ini_get('register_globals'))
 	 foreach( $_POST as $key => $value)
	  if (isset( $GLOBALS[ $key ]) && !isset( $$key)) $$key = &$GLOBALS[ $key ];

	$error = true;
	?>
	<tr>
	<td align="center" valign="top" colspan="3">

		<table class="bgwindow700" width="700" border=0 align="center" >
			<tr>
				<td width="694" align="left" valign="top" class="head">
					<img src="../../grafik/pixel.gif" width="1" height="7"><br>
					<?php echo ($SETUP_LANGUAGE_TEXT['setup_test_3']['title']); ?><br>
					<img src="../../grafik/spacer_700.gif" width="694" height="13"><br>
				</td>
			</tr>
			<tr>
			<td valign="top" >
				<?php
					if (!empty($SQL_UID))	echo "<span class='text'>{$SETUP_LANGUAGE_TEXT['db_uid']}: {$SQL_UID}<br></span>";
					if (!empty($SQL_PWD))	echo "<span class='text'>{$SETUP_LANGUAGE_TEXT['db_pwd']}: {$SQL_PWD}<br></span>";

					if (!empty($SQL_HOST))	echo "<span class='text'>{$SETUP_LANGUAGE_TEXT['db_host'][$SQL_VENDOR]}: {$SQL_HOST}<br></span>";
					if (!empty($SQL_SID))	echo "<span class='text'>{$SETUP_LANGUAGE_TEXT['db_sid'][$SQL_VENDOR]}: {$SQL_SID}<br></span>";
				?>
				<br>
				<?php

					class NaSystem 
					{
						var $os = 'UNIX';

						function NaSystem($os) {
							$this->os = $os;
						}

						function getOs() {
							return $this->os;
						}
					}

					if( strstr(strtolower($_SERVER['SERVER_SOFTWARE']),'microsoft') || strstr(strtolower($_SERVER['SERVER_SOFTWARE']),'win32')  || strpos(PHP_OS,'WIN') === 0) // Wenn NT-Server
					{
						$os				= 'WINDOWS';
					}
					else	// Wenn kein NT-Server
					{
						$os				= 'UNIX';
					}

					$na_system = new NaSystem($os);

					$config['host'] 		= $SQL_HOST;
					$config['pcon'] 		= (!empty($SQL_PCON));
					$config['sid'] 			= $SQL_SID;
					$config['uid'] 			= $SQL_UID;
					$config['pwd'] 			= $SQL_PWD;

					include_once('../../include/functions/string.fnc');
					include_once('../../include/functions/array.fnc');
					include_once('../../include/functions/sql.fnc');
					include_once('../../include/functions/cache.fnc');
					include_once('../../include/functions/'.$SQL_VENDOR.'.fnc');

					if (empty($GLOBALS['DC_ENV']))
					{
						/* DC_ENV Klasse simulieren - kommt sp├Ąter aus der base.php */
						if (!in_array('dcenv',get_declared_classes()))
						{
							class dcenv
							{
								 function dcenv()	{}
								 function _dcenv()	{}
							}
						}

						/* DC_ENV anlegen */
						$GLOBALS['DC_ENV'] = new dcenv();
						/* Die wichtigsten Werte eintragen */
						$GLOBALS['DC_ENV']->os				= @$_POST['PATH_OS'];
						$GLOBALS['DC_ENV']->cookiename		= @$_POST['PATH_COOKIE_NAME'];
						$GLOBALS['DC_ENV']->installpath		= @$_POST['PATH_INSTALL'];
						$GLOBALS['DC_ENV']->application_root= @$_POST['PATH_APPLICATION_ROOT'];
						$GLOBALS['DC_ENV']->cachepath		= @$_POST['PATH_CACHE'];
						$GLOBALS['DC_ENV']->tablepath		= @$_POST['PATH_CACHE'].'tables/';
						$GLOBALS['DC_ENV']->logs_path		= @$_POST['PATH_LOGS'];
					}

					$SQL = 'sql_'.$SQL_VENDOR;
					$SQL = new $SQL($na_system,$config);

					?> 
					<!-- 
					<?php
						$connected = $SQL->sql_connect();

						$db_test	 = true;
						$db_test_msg = ''; 
						if ($connected)
						{
							$table_def	= Array	(	'name'		=>	'test_table',
													'columns'	=> array 	(	'test_column' =>
																					array ( 'name'	  => 'test_column',
																							'type'	  => 'int',
																							'null'	  => 'null',
																							'default' => '',
																							'remark'  => ''
																							)
																			)
												);

							$SQL->sql_drop_table($table_def['name']);
							$SQL->sql_create_table($table_def);

							$table_created = ( empty($SQL->errnr) ? true : intval($SQL->errnr));

							if ($table_created === true )
							{
								$db_test_msg.= '<span class="textgreen">'.strtr($SETUP_LANGUAGE_TEXT['setup_test_3']['msg_table_created'],array(	'%0%'=> $table_def['name'])).'<br></span>';

								$SQL->sql_drop_table($table_def['name']);
								$table_deleted = ( empty($SQL->errnr) ? true : intval($SQL->errnr));
								if ($table_deleted)
								{
									$db_test_msg.= '<span class="textgreen">'.strtr($SETUP_LANGUAGE_TEXT['setup_test_3']['msg_table_deleted'],array(	'%0%'=> $table_def['name'])).'<br></span>';
								}
								else
								{
									$db_test 	 = false;
									$db_test_msg.= '<span class="textred">'.strtr($SETUP_LANGUAGE_TEXT['setup_test_3']['msg_table_not_deleted'],array(	'%0%'=> $table_def['name'],'%1%'=> $SQL->errnr.' '.$SQL->errstr)).'<br></span>';
								}
							}
							else 
							{ 
								$db_test 	 = false;
								$db_test_msg.= '<span class="textred">'.strtr($SETUP_LANGUAGE_TEXT['setup_test_3']['msg_table_not_created'],array(	'%0%'=> $table_def['name'],'%1%'=> $SQL->errnr.' '.$SQL->errstr)).'<br></span>';
							}
						}
						else
						{
							$db_test = false;
						}

						$SQL->sql_disconnect();
					?>
					-->		
					<?php echo $db_test_msg; ?>
				<br>
			</td>
		</table>
		<img src="../../grafik/bgwindow_482_stop.gif" width="700" height="14"><br>
		<table class="bgwindow700" width="700" border=0 align="center" >
			<tr>
				<td class="head"><?php echo $SETUP_LANGUAGE_TEXT['summary'];?> </td>
			</tr>
			<tr>
				<td  valign="top">
					<?php if ($db_test) : ?>
					<font class="textgreen"><?php echo $SETUP_LANGUAGE_TEXT['setup_test_3']['db_okay'];?></font>
					<?php else : ?>
					<font class="textred"><?php echo $SETUP_LANGUAGE_TEXT['setup_test_3']['db_error'];?></font>		
					<?php endif; ?>
				</td>
			</tr>
		</table>
		<img src="../../grafik/bgwindow_482_stop.gif" width="700" height="14"><br>
		<table class="bgwindow700" width="700" border=0 align="center" >
			<tr>
				<td class="head" width="33%" align="center" >
					<input type="button" class="create" value="<?php echo ($SETUP_LANGUAGE_TEXT['back']);?>" 	onClick="goOn('setup_4.php');" 	>
				</td>
				<td class="head" width="34%" align="center" >
					<input type="button" class="preview" value="<?php echo ($SETUP_LANGUAGE_TEXT['cancel']);?>" onClick="goOn('setup.php');" 	>				
				</td>				
				<td class="head" width="33%" align="center" >
					<?php if ($db_test) : ?>
					<input type="button" class="create" value="<?php echo ($SETUP_LANGUAGE_TEXT['next']);?>" 	onClick="goOn('setup_6.php');"  >
					<?php endif; ?>
				</td>
			</tr>
		</table>
		<img src="../../grafik/bgwindow_482_stop.gif" width="700" height="14"><br>		
		<script language="JavaScript" type="text/javascript">
		<!--
			if (parent && parent.frames['setupmain']) var p = parent.frames['setupmain'];
			if (window.opener ) var p = window.opener;
			if (p) p.document.forms[0].elements['ERROR_DB'].value='<?php echo ( $db_test ? '' : '1' );?>';
		//-->
		</script>		
	</td>
</table>
<br>
</form>
</body>
</html>
Return current item: Netautor Professional