Location: PHPKode > projects > Netautor Professional > netautor/napro4/admin/install/setup_3_test.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>    |
   |          Gregor Wollner                                              |
   +----------------------------------------------------------------------+
   | @version	$Revision: 1.16 $										  |
   +----------------------------------------------------------------------+*/

/**
 * Simple check of database connection
 *
 * @author Stefan Rottensteiner
 */

require_once ('./setup.inc'); 
if (empty($_POST['SETUP_CHECK']))
{
	?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
	<html>
	<body>
	<script language="JavaScript" type="text/javascript">	
	<!-- 
	if (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.php"
	}
	-->
	</script>
	</body></html>
	<?php
	die();
}

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>
		<title><?php echo ($SETUP_LANGUAGE_TEXT['setup_test_3']['title']);?></title>
		<meta name="Description" content="<?php echo SOFTWARE_NAME_FULL; ?> <?php echo SOFTWARE_VERSION_FULL; ?> Setup Test Step 3">
		<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();
	}
	-->
	</script>
<body class="brown">
<form method="post" action="setup_3_test.php">
<?php 
	echo(setup_getMyVars($_POST));
	$error = true;
?>
<br>
<table border="0" cellspacing="0" cellpadding="0" align="center" valign="top">
	<tr>
		<td align="center" class="text"><font class="head"><?php echo ($SETUP_LANGUAGE_TEXT['setup_test_3']['title']);?></font></td>
	</tr>
	<tr>
		<td class="text">&nbsp;</td>
	</tr>
	<tr>
		<td align="center" class="text">
			<input type="button" class="clear" onClick="closeMe();" value="<?php echo($SETUP_LANGUAGE_TEXT['close_window']);?>">
		</td>
	</tr>
	<tr>
		<td class="text">&nbsp;</td>
	</tr>
	<tr>
	<td align="center" valign="top">
	<table width="600" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td class="text">
				<br><font class="text"><b><?php echo($SETUP_LANGUAGE_TEXT['setup_test_3']['connect_2_db']);?></b></font><br>
				<font class="textgreen"><?php echo ("$SQL_UID:$SQL_PWD@$SQL_HOST/$SQL_SID");?></font>
				<br>
			</td>
		</tr>
		<tr>
		<td class="text"><?php
		class NaSystem 
		{
			var $os = 'UNIX';

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

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

		if (empty($SERVER_SOFTWARE)) $SERVER_SOFTWARE=getenv('SERVER_SOFTWARE');
		if (empty($SERVER_SOFTWARE)) $SERVER_SOFTWARE=$GLOBALS['HTTP_SERVER_VARS']['SERVER_SOFTWARE'];
		if (empty($SERVER_SOFTWARE)) @$SERVER_SOFTWARE=$_SERVER['SERVER_SOFTWARE'];
		if (empty($SERVER_SOFTWARE)) $SERVER_SOFTWARE='&lt; NOT AVAILABLE gt&;';

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

		?> 
		<div style="visibility: hidden; display: none;">
		<!-- 
		<?php

		$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');

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

			$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;
			}
		?>
		-->
		</div>
		<br>
		<?php echo $db_test_msg; ?>
		<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>		
		<?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; ?>

		<!-- <?php	$SQL->sql_disconnect();	?> -->
		</td>
		</tr>
	</table>
	</td>
	</tr>
</table>
<br>
</form>
</body>
</html>
Return current item: Netautor Professional