Location: PHPKode > projects > OpenDataCenter Network Management System > install.php
<?php

// ----------------------------------------------------------------------
// Copyright (C) 2007 by GREGORY LE BRAS
// ----------------------------------------------------------------------
// LICENSE
//
// This file is part of ODCNMS - Open DataCenter Network Management System
// 
// ODCNMS is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// Foobar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Foobar; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
// ----------------------------------------------------------------------
// Original Author of file: GREGORY LE BRAS - http://www.odcnms.org/
// ----------------------------------------------------------------------

include('version.php');

require('class/class.phpextensions.php');

if(!file_exists("config/config.php")) // If config/config.php exist
{

if (isset($_COOKIE["ODCNMSLANG"]))
{
	$language = $_COOKIE["ODCNMSLANG"];
	include('language/'.$language.'.php');
}
else
{
	include('language/en.php');	
}

	if(!isset($option))
	{	
	?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title><?php echo TXT_WELCOME_INSTALLATION; ?></title>
	<link rel="shortcut icon" href="images/favicon.gif">	
	<link href="stylesheets/style.css" rel=StyleSheet type=text/css>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Content-Language" content="en-us">
</head>
<noscript>
<div id="noscript"><?php echo TXT_NO_SCRIPT; ?></div>
</noscript>
<a name="top"></a>
<div id="header">&nbsp;</div>
<div id="login">
	<form action="install.php?option=check" method="post" class="form">
		<img src="images/logo_odcnms.png" alt="LOGO ODCNMS">
		<h2 style="color:#0000cc;"><?php echo TXT_INSTALLATION_VERSION; ?></h2>
		<h3><?php echo TXT_WELCOME_INSTALLATION; ?></h3>
		<p><?php echo TXT_OPTION_ODCNMS; ?></p>
		<b style="position:relative;top:-10px;"><?php echo TXT_LANGUAGE; ?> :</b> <select name="lang"><option value="en">English</option><option value="fr">French</option></select><br><br>
		<b style="position:relative;top:-10px;"><?php echo TXT_RADIUS_AUTHENTICATION; ?> :</b> <select name="radius"><option value="1"><?php echo TXT_YES; ?></option><option value="0"><?php echo TXT_NO; ?></option></select><br><br>		
		<input type="submit" name="submit" value="<?php echo TXT_GO; ?> >>">
	</form>
</div>
</html>
	<?php
	}
	else if ($option=="check")
	{	
		SetCookie("ODCNMSLANG",$lang,time()+86400);
		
		$configurationcheck=0;
		?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title><?php echo TXT_WELCOME_INSTALLATION; ?></title>
	<link rel="shortcut icon" href="images/favicon.gif">	
	<link href="stylesheets/style.css" rel=StyleSheet type=text/css>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Content-Language" content="en-us">
</head>
<noscript>
<div id="noscript"><?php echo TXT_NO_SCRIPT; ?></div>
</noscript>
<a name="top"></a>
<div id="header">&nbsp;</div>
<div id="login">
	<form action="install.php?option=parameters" method="post" class="form">
		<img src="images/logo_odcnms.png" alt="LOGO ODCNMS">
		<h2 style="color:#0000cc;"><?php echo TXT_INSTALLATION_VERSION; ?></h2>
		<h3><?php echo TXT_CHECKING_CONFIGURATION; ?></h3>
		<h4 style="color:#0000cc"><?php echo TXT_PHP_MODULES; ?></h4>
<?php

$modules = new moduleCheck();

if($modules->isLoaded('mysql')) { // Test if mysql is loaded
  echo '<p><img src="images/accept.png" alt="OK"> <b style="color:green">MySQL '.TXT_LOADED.'</b></p>';
} else {
  echo '<p><img src="images/cancel.png" alt="NO"> <b style="color:red">MySQL '.TXT_NOT_LOADED.'</b></p>';
  $configurationcheck=1;
}

if ($radius=="1")
{
	if($modules->isLoaded('radius')) { // Test if radius is loaded
	  echo '<p><img src="images/accept.png" alt="OK"> <b style="color:green">RADIUS '.TXT_LOADED.'</b></p>';
	} else {
	  echo '<p><img src="images/cancel.png" alt="NO"> <b style="color:red">RADIUS '.TXT_NOT_LOADED.'</b></p>';
	  $configurationcheck=1;  
	}
}

if($modules->isLoaded('snmp')) { // Test if SNMP is loaded
  echo '<p><img src="images/accept.png" alt="OK"> <b style="color:green">SNMP '.TXT_LOADED.'</b></p>';
} else {
  echo '<p><img src="images/cancel.png" alt="NO"> <b style="color:red">SNMP '.TXT_NOT_LOADED.'</b></p>';
  $configurationcheck=1;  
}
?>
		<h4 style="color:#0000cc"><?php echo TXT_FILES_PERMISSIONS; ?></h4>
<?php

$filename = 'config';
if (is_writable($filename)) {
   echo '<p><img src="images/accept.png" alt="OK"> <b style="color:green">'.TXT_DIRECTORY_WRITABLE.'</b></p>';
} else {
   echo '<p><img src="images/cancel.png" alt="NO"> <b style="color:red">'.TXT_DIRECTORY_NOT_WRITABLE.'</b></p>';
   $configurationcheck=1;
}

if ($configurationcheck=="1")
{
?>
	<h4 style="color:red"><img src="images/warning.png" alt="warning" align="center"> <?php echo TXT_ODCNMS_CANNOT_BE_INSTALLED; ?></h4>
	<input type="submit" name="submit" value="<?php echo TXT_NEXT_STEP; ?> >>" disabled>
<?php
}
else
{
?>
	<h4><img src="images/info.png" alt="info" align="center"> <?php echo TXT_ODCNMS_CAN_BE_INSTALLED; ?></h4>
	<input type="hidden" name="radius" value="<?php echo $radius; ?>">
	<input type="submit" name="submit" value="<?php echo TXT_NEXT_STEP; ?> >>">
<?php
}
?>
	</form>
</div>
</html>
		<?php
	}
	else if ($option=="parameters")
	{
		?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title><?php echo TXT_WELCOME_INSTALLATION; ?></title>
	<link rel="shortcut icon" href="images/favicon.gif">	
	<link href="stylesheets/style.css" rel=StyleSheet type=text/css>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Content-Language" content="en-us">
</head>
<noscript>
<div id="noscript"><?php echo TXT_NO_SCRIPT; ?></div>
</noscript>
<a name="top"></a>
<div id="header">&nbsp;</div>
<div id="login">
	<form action="install.php?option=install" method="post" class="form">
		<img src="images/logo_odcnms.png" alt="LOGO ODCNMS">
		<h2 style="color:#0000cc;"><?php echo TXT_INSTALLATION_VERSION; ?></h2>
		<?php
		
		if ($radius=="1")
		{
		?>
		<h3><?php echo TXT_RADIUS_PARAMETERS; ?></h3>
		<table align="center" width="450px" style="margin-right:33%">
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_SERVER_ADDRESS; ?> :</b> </td>
				<td><input type="text" size="30" name="hostname"></td>
			</tr>
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_PORT; ?> :</b> </td>
				<td><input type="text" size="30" name="port" value="1812"></td>
			</tr>	
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_SHARED_SECRET; ?> :</b> </td>
				<td><input type="password" size="30" name="secret"></td>
			</tr>
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_TIMEOUT; ?> :</b> </td>
				<td><input type="text" size="30" name="timeout" value="3"></td>
			</tr>	
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_MAX_TRIES; ?> :</b> </td>
				<td><input type="text" size="30" name="max_tries" value="2"></td>
			</tr>			
		</table>
		<h3><?php echo TXT_ADMIN_PARAMETERS; ?></h3>
		<table align="center" width="500px" style="margin-right:33%">
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_USERNAME; ?> :</b> </td>
				<td><input type="text" size="30" name="admin_username" value="admin"></td>
			</tr>	
		</table>		
		<?php
		}
		else
		{
		?>
		<h3><?php echo TXT_ADMIN_PARAMETERS; ?></h3>
		<table align="center" width="500px" style="margin-right:33%">
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_USERNAME; ?> :</b> </td>
				<td><input type="text" size="30" name="admin_username" value="admin"></td>
			</tr>	
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_PASSWORD; ?> :</b> </td>
				<td><input type="text" size="30" name="admin_password" value="odcnms"></td>
			</tr>			
		</table>
		<input type="hidden" name="hostname" value="">
		<input type="hidden" name="port" value="">
		<input type="hidden" name="secret" value="">
		<input type="hidden" name="timeout" value="">
		<input type="hidden" name="max_tries" value="">
		<?php
		}
		?>
		<h3><?php echo TXT_SYSLOG_PARAMETERS; ?></h3>
		<table align="center" width="450px" style="margin-right:33%">
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_SERVER_ADDRESS; ?> :</b> </td>
				<td width="50%"><input type="text" size="30" name="syslog_server_primary" value=""></td>
			</tr>
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_BACKUP_SERVER_ADDRESS; ?> :</b> </td>
				<td width="50%"><input type="text" size="30" name="syslog_server_backup" value=""></td>
			</tr>
		</table>		
		<h3><?php echo TXT_DATABASE_PARAMETERS; ?></h3>
		<table align="center" width="450px" style="margin-right:33%">
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_SERVER_ADDRESS; ?> :</b> </td>
				<td><input type="text" size="30" name="mysql_hostname" value=""></td>
			</tr>
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_USERNAME; ?> :</b> </td>
				<td><input type="text" size="30" name="mysql_username" value=""></td>
			</tr>	
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_PASSWORD; ?> :</b> </td>
				<td><input type="password" size="30" name="mysql_password" value=""></td>
			</tr>
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_DATABASE_NAME; ?> :</b> </td>
				<td><input type="text" size="30" name="mysql_database" value="odcnms"></td>
			</tr>	
			<tr>
				<td align="right" valign="bottom" width="50%"><b style="position:relative;top:-10px;"><?php echo TXT_TABLE_PREFIX; ?> :</b> </td>
				<td><input type="text" size="30" name="mysql_prefix" value="odcnms_"></td>
			</tr>			
		</table>
		<br>
		<input type="hidden" name="radius" value="<?php echo $radius; ?>">
		<input type="submit" name="submit" value="<?php echo TXT_INSTALL; ?> >>">
	</form>
</div>
</html>
		<?php
	}
	else if ($option=="install")
	{
	$gologin=0;
   $fp=fopen("config/config.php","a+");
	
   $data="<?php \n";
   $data.="/********************************************
*****RADIUS Authentication Configuration*******
 ********************************************/

\$radius_authentication='$radius'; // The radius authentication parameter specifies if you use Radius Authentication instead of ODCNMS authentication.
\$hostname='$hostname'; // The hostname parameter specifies the server host, either as a fully qualified domain name or as a dotted-quad IP address in text form.
\$port='$port'; // The port specifies the UDP port to contact on the server. If port is given as 0, the library looks up the radius/udp or radacct/udp service in the network services database, and uses the port found there. If no entry is found, the library uses the standard Radius ports, 1812 for authentication and 1813 for accounting.
\$secret='$secret'; // The shared secret for the server host is passed to the secret parameter. The Radius protocol ignores all but the leading 128 bytes of the shared secret.
\$timeout='$timeout'; // The timeout for receiving replies from the server is passed to the timeout parameter, in units of seconds.
\$max_tries='$max_tries'; // The maximum number of repeated requests to make before giving up is passed into the max_tries.

/********************************************
*****Syslog Configuration*******
 ********************************************/

\$syslog_server=array('$syslog_server_primary','$syslog_server_backup');\n";
   $data.="/********************************************\n
**************MySQL Configuration************\n
 ********************************************/\n";
   $data.="\$mysql_hostname='$mysql_hostname';\n
\$mysql_username='$mysql_username';\n
\$mysql_password='$mysql_password';\n
\$mysql_database='$mysql_database';\n
\n
// Database Table Configuration\n
\n
\$name_table_users='".$mysql_prefix."users';\n
\$name_table_users_log='".$mysql_prefix."users_log';\n
\$name_table_location='".$mysql_prefix."location';\n
\$name_table_rack='".$mysql_prefix."rack';\n
\$name_table_patch_panel='".$mysql_prefix."patch_panel';\n
\$name_table_port='".$mysql_prefix."port';\n
\$name_table_customer='".$mysql_prefix."customer';\n
\$name_table_link_location_customer='".$mysql_prefix."link_location_customer';\n
\$name_table_network='".$mysql_prefix."network';\n
\$name_table_subnet='".$mysql_prefix."subnet';\n
\$name_table_ip_address='".$mysql_prefix."ip_address';\n
\$name_table_link_customer_subnet='".$mysql_prefix."link_customer_subnet';\n
\$name_table_link_port_port='".$mysql_prefix."link_port_port';\n
\$name_table_device='".$mysql_prefix."device';\n
\$name_table_vlan='".$mysql_prefix."vlan';\n
\$name_table_link_subnet_vlan='".$mysql_prefix."link_subnet_vlan';\n
\$name_table_category='".$mysql_prefix."category';\n
\$name_table_manufacturer='".$mysql_prefix."manufacturer';\n
\$name_table_model='".$mysql_prefix."model';\n
\$name_table_slot='".$mysql_prefix."slot';\n
\$name_table_interface='".$mysql_prefix."interface';\n
\$name_table_link_interface_interface='".$mysql_prefix."link_interface_interface';\n
\$name_table_link_port_interface='".$mysql_prefix."link_port_interface';\n
\$name_table_link_device_ip_address='".$mysql_prefix."link_device_ip_address';\n
\$name_table_link_vlan_device='".$mysql_prefix."link_vlan_device';\n
\$name_table_model_slot='".$mysql_prefix."model_slot';\n";
   $data.="?>";
	
	// Write to file
	$write=fwrite($fp,$data);
	
	if(!$write)
	{
		$rapp_table_configphp="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
	}
	else
	{
		$rapp_table_configphp="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
	}
		
	//--------------------------------------
	// Create Table
	//--------------------------------------
	
	$db_connect=mysql_connect($mysql_hostname,$mysql_username,$mysql_password);
	mysql_select_db($mysql_database,$db_connect);
	
   $category=mysql_query("CREATE TABLE `".$mysql_prefix."category` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$category)
    {
        $rapp_table_category="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_category="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }
	
   $customer=mysql_query("CREATE TABLE `".$mysql_prefix."customer` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$customer)
    {
        $rapp_table_customer="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_customer="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $device=mysql_query("CREATE TABLE `".$mysql_prefix."device` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `ip_address_id` int(10) default NULL,
  `model_id` int(10) unsigned default NULL,
  `rack_id` int(10) unsigned default NULL,
  `description` varchar(255) default NULL,
  `snmp_read_community` varchar(100) default NULL,
  `snmp_port` int(5) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$device)
    {
        $rapp_table_device="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_device="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $interface=mysql_query("CREATE TABLE `".$mysql_prefix."interface` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `slot_id` int(10) unsigned default NULL,
  `type` int(10) unsigned default NULL,
  `speed` int(5) unsigned default NULL,
  `index` int(5) unsigned default NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$interface)
    {
        $rapp_table_interface="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_interface="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
 $ip_address=mysql_query("CREATE TABLE `".$mysql_prefix."ip_address` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `subnet_id` int(10) unsigned default NULL,
  `ip` varchar(15) default NULL,
  `mac_address` varchar(17) default NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  `status` int(1) unsigned default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$ip_address)
    {
        $rapp_table_ip_address="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_ip_address="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $link_customer_subnet=mysql_query("CREATE TABLE `".$mysql_prefix."link_customer_subnet` (
  `customer_id` int(10) unsigned default NULL,
  `subnet_id` int(10) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_customer_subnet)
    {
        $rapp_table_link_customer_subnet="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_customer_subnet="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }
	
	 $link_device_ip_address=mysql_query("CREATE TABLE `".$mysql_prefix."link_device_ip_address` (
  `device_id` int(10) unsigned default NULL,
  `ip_address_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_device_ip_address)
    {
        $rapp_table_link_device_ip_address="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_device_ip_address="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
	 $link_interface_interface=mysql_query("CREATE TABLE `".$mysql_prefix."link_interface_interface` (
  `interface_id` int(10) unsigned default NULL,
  `interface2_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_interface_interface)
    {
        $rapp_table_link_interface_interface="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_interface_interface="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	
	 $link_port_interface=mysql_query("CREATE TABLE `".$mysql_prefix."link_port_interface` (
  `port_id` int(10) unsigned NOT NULL,
  `interface_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_port_interface)
    {
        $rapp_table_link_port_interface="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_port_interface="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }
	
	 $link_port_port=mysql_query("CREATE TABLE `".$mysql_prefix."link_port_port` (
  `port_id` int(10) unsigned default NULL,
  `port2_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_port_port)
    {
        $rapp_table_link_port_port="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_port_port="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
	 $link_subnet_vlan=mysql_query("CREATE TABLE `".$mysql_prefix."link_subnet_vlan` (
  `subnet_id` int(10) unsigned default NULL,
  `vlan_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_subnet_vlan)
    {
        $rapp_table_link_subnet_vlan="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_subnet_vlan="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $link_vlan_device=mysql_query("CREATE TABLE `".$mysql_prefix."link_vlan_device` (
  `vlan_id` int(10) unsigned default NULL,
  `device_id` int(10) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");

    if(!$link_vlan_device)
    {
        $rapp_table_link_vlan_device="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_link_vlan_device="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
 $location=mysql_query("CREATE TABLE `".$mysql_prefix."location` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `description` varchar(512) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$location)
    {
        $rapp_table_location="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_location="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $manufacturer=mysql_query("CREATE TABLE `".$mysql_prefix."manufacturer` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$manufacturer)
    {
        $rapp_table_manufacturer="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_manufacturer="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
 $model=mysql_query("CREATE TABLE `".$mysql_prefix."model` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `manufacturer_id` int(10) unsigned default NULL,
  `category_id` int(10) unsigned default NULL,
  `name` varchar(255) default NULL,
  `layer` int(2) unsigned default NULL,
  `height` int(10) unsigned default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$model)
    {
        $rapp_table_model="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_model="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }

 $model_slot=mysql_query("CREATE TABLE `".$mysql_prefix."model_slot` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `model_id` int(10) unsigned default NULL,
  `number` int(10) unsigned default NULL,
  `interface_density` int(10) unsigned default NULL,
  `interface_type` int(10) unsigned default NULL,
  `interface_speed` int(10) unsigned default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$model_slot)
    {
        $rapp_table_model_slot="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_model_slot="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	

	 $network=mysql_query("CREATE TABLE `".$mysql_prefix."network` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `address` varchar(15) default NULL,
  `mask` varchar(15) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$network)
    {
        $rapp_table_network="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_network="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
	 $patch_panel=mysql_query("CREATE TABLE `".$mysql_prefix."patch_panel` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `rack_id` int(10) unsigned default NULL,
  `port_density` int(10) unsigned default NULL,
  `height` int(10) unsigned default NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$patch_panel)
    {
        $rapp_table_patch_panel="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_patch_panel="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }
	
	 $port=mysql_query("CREATE TABLE `".$mysql_prefix."port` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `patch_panel_id` int(10) unsigned default NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$port)
    {
        $rapp_table_port="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_port="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
	 $rack=mysql_query("CREATE TABLE `".$mysql_prefix."rack` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `location_id` int(10) unsigned default NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$rack)
    {
        $rapp_table_rack="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_rack="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	
	 $slot=mysql_query("CREATE TABLE `".$mysql_prefix."slot` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `device_id` int(10) unsigned default NULL,
  `number` int(10) unsigned default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$slot)
    {
        $rapp_table_slot="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_slot="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }	
	
	 $subnet=mysql_query("CREATE TABLE `".$mysql_prefix."subnet` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `network_id` int(10) unsigned NOT NULL,
  `name` varchar(255) default NULL,
  `address` varchar(15) default NULL,
  `mask` varchar(15) default NULL,
  `status` int(1) unsigned default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$subnet)
    {
        $rapp_table_subnet="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_subnet="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	 $users=mysql_query("CREATE TABLE `".$mysql_prefix."users` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(255) default NULL,
  `password` varchar(255) default NULL,
  `administrator` tinyint(1) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$users)
    {
        $rapp_table_users="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_users="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	 $users_log=mysql_query("CREATE TABLE `".$mysql_prefix."users_log` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `users_id` int(10) unsigned default NULL,
  `date` date default NULL,
  `time` time default NULL,
  `action` varchar(255) default NULL,
  `what` varchar(255) NOT NULL,
  `description` longtext,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$users_log)
    {
        $rapp_table_users_log="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;		
    }
	else
    {
        $rapp_table_users_log="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	 $vlan=mysql_query("CREATE TABLE `".$mysql_prefix."vlan` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `number` int(5) NOT NULL,
  `name` varchar(255) default NULL,
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");

    if(!$vlan)
    {
        $rapp_table_vlan="<font color='red'><b> [ ".TXT_ERROR." ] </b></font>";
		$gologin=1;
    }
	else
    {
        $rapp_table_vlan="<font color='green'><b> [ ".TXT_OK." ] </b></font>";
    }		
	
	if ($radius=="1")
	{
		$insertadminuser=mysql_query("INSERT INTO `".$mysql_prefix."users` VALUES ('',\"$admin_username\",'',\"1\")") or die ("ERROR!");
	}
	else if ($radius=="0")
	{
		$md5_admin_password=md5($admin_password);
		$insertadminuser=mysql_query("INSERT INTO `".$mysql_prefix."users` VALUES ('',\"$admin_username\",\"$md5_admin_password\",\"1\")") or die ("ERROR!");
	}

		?>
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title><?php echo TXT_WELCOME_INSTALLATION; ?></title>
	<link rel="shortcut icon" href="images/favicon.gif">	
	<link href="stylesheets/style.css" rel=StyleSheet type=text/css>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Content-Language" content="en-us">
</head>
<noscript>
<div id="noscript"><?php echo TXT_NO_SCRIPT; ?></div>
</noscript>
<a name="top"></a>
<div id="header">&nbsp;</div>
<div id="login">
	<form action="index.php" method="post" class="form">
		<img src="images/logo_odcnms.png" alt="LOGO ODCNMS">
		<h2 style="color:#0000cc;"><?php echo TXT_INSTALLATION_VERSION; ?></h2>
		<h3><?php echo TXT_CONFIGPHP_FILE_CREATION; ?></h3>
		<?php echo $rapp_table_configphp; ?>
		<h3><?php echo TXT_TABLES_CREATION; ?></h3>
		<?php echo TXT_CATEGORY; ?> <?php echo $rapp_table_category; ?><br>
		<?php echo TXT_CUSTOMER; ?> <?php echo $rapp_table_customer; ?><br>
		<?php echo TXT_DEVICE; ?> <?php echo $rapp_table_device; ?><br>
		<?php echo TXT_INTERFACE; ?> <?php echo $rapp_table_interface; ?><br>
		<?php echo TXT_IP_ADDRESS; ?> <?php echo $rapp_table_ip_address; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_CUSTOMER; ?> <?php echo TXT_SUBNET; ?> <?php echo $rapp_table_link_customer_subnet; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_DEVICE; ?> <?php echo TXT_IP_ADDRESS; ?> <?php echo $rapp_table_link_device_ip_address; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_INTERFACE; ?> <?php echo TXT_INTERFACE; ?> <?php echo $rapp_table_link_interface_interface; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_PORT; ?> <?php echo TXT_INTERFACE; ?> <?php echo $rapp_table_link_port_interface; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_PORT; ?> <?php echo TXT_PORT; ?> <?php echo $rapp_table_link_port_port; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_SUBNET; ?> <?php echo TXT_VLAN; ?> <?php echo $rapp_table_link_subnet_vlan; ?><br>
		<?php echo TXT_LINK; ?> <?php echo TXT_VLAN; ?> <?php echo TXT_DEVICE; ?> <?php echo $rapp_table_link_vlan_device; ?><br>
		<?php echo TXT_LOCATION; ?> <?php echo $rapp_table_location; ?><br>
		<?php echo TXT_MANUFACTURER; ?> <?php echo $rapp_table_manufacturer; ?><br>
		<?php echo TXT_MODEL; ?> <?php echo $rapp_table_model; ?><br>
		<?php echo TXT_MODEL_SLOT; ?><?php echo $rapp_table_model_slot; ?><br>
		<?php echo TXT_NETWORK; ?> <?php echo $rapp_table_network; ?><br>
		<?php echo TXT_PATCH_PANEL; ?> <?php echo $rapp_table_patch_panel; ?><br>
		<?php echo TXT_PORT; ?> <?php echo $rapp_table_port; ?><br>
		<?php echo TXT_RACK; ?> <?php echo $rapp_table_rack; ?><br>
		<?php echo TXT_SLOT; ?> <?php echo $rapp_table_slot; ?><br>
		<?php echo TXT_SUBNET; ?> <?php echo $rapp_table_subnet; ?><br>
		<?php echo TXT_USERS; ?> <?php echo $rapp_table_users; ?><br>
		<?php echo TXT_USERS_LOG; ?> <?php echo $rapp_table_users_log; ?><br>
		<?php echo TXT_VLAN; ?> <?php echo $rapp_table_vlan; ?><br>
		<?php
		
		if ($gologin==1)
		{
			?>
			<h3 style="color:red"><?php echo TXT_UNABLE_INSTALL_ODCNMS; ?></h3>
			<br><input type="submit" name="submit" value="<?php echo TXT_LOG_IN; ?> >>" disabled>
			<?php
		}
		else
		{
			?>
			<h3 style="color:green"><?php echo TXT_ODCNMS_SUCCESSFULLY_INSTALLED; ?></h3>
			<br><input type="submit" name="submit" value="<?php echo TXT_LOG_IN; ?> >>">
			<?php
		}
		?>
	</form>
</div>
</html>	
	<?php
}	
}
else
{
	header("Location: index.php"); 
}
?>
Return current item: OpenDataCenter Network Management System