Location: PHPKode > projects > Netautor Professional > netautor/napro4/admin/database/perform/db_select.php
<?php 
	error_reporting(1);
	/**
	 * @version	$Revision: 1.5 $
	 * @author	Stefan Rottensteiner
	 */
	require_once('../../../include/init.inc');
	if(!$USER->check_feature('Admin') && !$USER->check_feature('ac_database'))
	{
		$USER->login_call();
	}

	/* Löschen des letzen Testdurchlaufes */
	$GLOBALS['NA_PRO_CACHE']['_DB_PERFORMANCE']['LAST_RUN'] = array();

	include_once ('./common.php');

	if (file_exists('./db.cfg'))
	{
		$CONFIG = unserialize(implode('',file('./db.cfg')));
		ksort($CONFIG);
	}
	else
	{
		$CONFIG=array();
	}
	if (!empty($button_load))
	{
		if ($button_load=='--install--')
		{
			$CFG_DB_TYPE	= $GLOBALS['sql_conf']['vendor'];
			$CFG_USER_NAME	= $GLOBALS['sql_conf']['uid'];
			$CFG_USER_PASS	= $GLOBALS['sql_conf']['pwd'];
			$CFG_TABLESPACE	= $GLOBALS['sql_conf']['sid'];
			$CFG_DSN		= $GLOBALS['sql_conf']['host'];
			$CFG_NAME		= '--install--';
			$CFG_PROFILE	= 1;

		}
		else
		{
			foreach ($FIELDS as $idx => $data)	$$data = 		$CONFIG[ $button_load ][ $data ] ;
		}
	}

	@$CFG_REPETITIONS	= max (1,intval($CFG_REPETITIONS));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>DB Config</title>
	<link href="style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript">
<!--
function checkStatement()
{
	var f	= document.forms[1];
	var	e	= f.elements['CFG_STATEMENT'];
	if (!e.value || e.value=="")
	{
		alert("ERROR : Cannot test without a valid SQL-Statement ");
		return false;
	}
	else
	{
		return true;
	}
}
//-->
</script>
<body>
<font class="text">


	<table border="0" cellspacing="0" cellpadding="2">
	<form>
		<tr>
			<td></td>
			<td class="text" rowspan="2">
				<select name="button_load" onChange="this.form.submit();" class="select">
					<option <?php if (empty($CFG_NAME)) echo 'selected'; ?> value=''> -- NEW -- </option>
					<option <?php if ($CFG_NAME =='--install--') echo 'selected'; ?> value='--install--'> -- INSTALL -- </option>
				<?php
				foreach ($CONFIG as $idx => $data)
				{
					if (empty($data['CFG_NAME'])) continue;
					$selected = ($CFG_NAME== $data['CFG_NAME'] ? 'selected' : '');
					echo "<option $selected value='{$data['CFG_NAME']}'>{$data['CFG_NAME']}</option>";
				}
				?>
				</select>
			</td>
	</form>
		</tr>
	<form target="db_test" >
		<input type="hidden" name="CFG_NAME" value="<?php echo $CFG_NAME;?>">
		<tr>
			<td>
				<input type="button" name="somename2" value=" Profiles " class="button" onClick="this.form.action='./db_config_edit.php';this.form.submit();" >
			</td>
		</tr>
		<tr><td colspan="2"><hr></td></tr>
		<tr>
			<td class="text">
				DB Type
			</td>
			<td class="text">
				<select name="CFG_DB_TYPE" class="select" onChange="this.form.action = './db_header.php';">
					<option value="" 		<?php if (empty($CFG_DB_TYPE)) 	 echo 'selected';  ?> ></option>
					<option value="mysql" 	<?php if ($CFG_DB_TYPE=='mysql') echo 'selected';  ?>>mySQL</option>
					<option value="odbc"	<?php if ($CFG_DB_TYPE=='odbc')  echo 'selected';  ?>>MSSQL via ODBC</option>
					<option value="mssql"	<?php if ($CFG_DB_TYPE=='mssql') echo 'selected';  ?>>MSSQL via PHP</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="text">
				Host / ODBC-ID
			</td>
			<td class="text">
				<input type="text" name="CFG_DSN" value="<?php echo $CFG_DSN;?>" class="input">
			</td>
		</tr>

		<tr>
			<td class="text">
				Tablespace
			</td>
			<td class="text">
				<input type="text" name="CFG_TABLESPACE" value="<?php echo $CFG_TABLESPACE;?>" class="input">
			</td>
		</tr>
		<tr>
			<td class="text">
				User name
			</td>
			<td class="text">
				<input type="text" name="CFG_USER_NAME" value="<?php echo $CFG_USER_NAME;?>" class="input">
			</td>
		</tr>
		<tr>
			<td class="text">
				User password
			</td>
			<td class="text">
				<input type="text" name="CFG_USER_PASS" value="<?php echo $CFG_USER_PASS;?>" class="input">
			</td>
		</tr>
		<tr>
			<td class="text">
				Persistent
			</td>
			<td class="text">
				<input class="radio" type="radio" <?php if (empty($CFG_PERSISTENT)) echo 'checked';  ?>  name="CFG_PERSISTENT" value="0"> NO
				<input class="radio" type="radio" <?php if (!empty($CFG_PERSISTENT)) echo 'checked'; ?> name="CFG_PERSISTENT" value="1"> YES
			</td>
		</tr>
		<tr><td colspan="2"><hr></td></tr>
		<tr>
			<td class="text" colspan="2">
				Statement
			</td>
		</tr>
		<tr>
			<td class="text" colspan="2">
				<textarea class="input" name="CFG_STATEMENT" rows="5" cols="40" ><?php echo htmlspecialchars($CFG_STATEMENT);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="text">
				PROFILING
			</td>
			<td class="text">
				<input class="radio" type="radio" <?php if (empty($CFG_PROFILE)) echo 'checked';  ?> name="CFG_PROFILE" value="0"> NO
				<input class="radio" type="radio" <?php if (!empty($CFG_PROFILE)) echo 'checked'; ?> name="CFG_PROFILE" value="1"> YES
			</td>
		</tr>
		<tr>
			<td class="text">
						Repetitions
			</td>
			<td class="text">
				<input type="input" name="CFG_REPETITIONS" size="5"value="<?php echo $CFG_REPETITIONS;?>" class="input">
				<select class="select"
				onChange="this.form.elements['CFG_REPETITIONS'].value = (this.options[ this.selectedIndex ].value);">
					<option></option>
					<option value="10">10</option>
					<option value="50">50</option>
					<option value="100">100</option>
					<option value="500">500</option>
					<option value="1000">1000</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="text">
				Show results
			</td>
			<td class="text">
				<input class="radio" type="radio" <?php if (empty($SHOW_RESULT)) echo 'checked';  ?> name="SHOW_RESULT" value="0"> NO
				<input class="radio" type="radio" <?php if (!empty($SHOW_RESULT)) echo 'checked'; ?> name="SHOW_RESULT" value="1"> YES
			</td>
		</tr>

		<tr><td colspan="2"><hr></td></tr>
		<tr>
			<td class="text" colspan="2" align="center">
				<input type="button" name="somename" value="!! TestIt !!" class="button" onClick="if (checkStatement()) {this.form.action= './db_header.php';this.form.submit();}">
				<!--<input type="reset" name="somename2" value="Clear" class="button">-->
			</td>
		</tr>

	</table>

</form>

</font>
</body>
</html>
Return current item: Netautor Professional