<?php 
if(file_exists("../conn.php")){
header("Location: master.php");
exit();
}

if(isset($_POST['createconfig'])){
if(!file_exists("../conn.php")){

$hostname=trim($_POST['hostname']);
$username=trim($_POST['username']);
$password=trim($_POST['password']);
$databasename=trim($_POST['databasename']);
$conncontent='<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true" 
$hostname_eclipse = "'.$hostname.'"; 
$database_eclipse = "'.$databasename.'";
$username_eclipse = "'.$username.'";
$password_eclipse = "'.$password.'";
$eclipse = mysql_connect($hostname_eclipse, $username_eclipse, $password_eclipse) or trigger_error(mysql_error(),E_user_ERROR);
$selected = mysql_select_db($database_eclipse,$eclipse)
or die ("Could not select database."); 
?>';
$filepath="../conn.php";

     $fd = fopen ($filepath, "wb");  
     $out = fwrite ($fd, $conncontent);  
     fclose ($fd);  
	 
header("Location: master.php");
exit();

}else{
header("Location: master.php");
exit();

}

}

?>

<link href="ssi.css" rel="stylesheet" type="text/css">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td colspan="2" class="bluelogTxt">Welcome To Install the Master Table </td>
  </tr>
  <tr>
    <td colspan="2" align="center">
	<form method="post" action="">
	<table width="50%"  border="0" cellspacing="4" cellpadding="3">
      <tr>
        <td height="30" colspan="2" class="bigblackTxt">Data base Details to create conn file </td>
        </tr>
      <tr>
        <td width="35%" class="bluebold">Host Name: </td>
        <td width="65%"><input name="hostname" type="text" id="hostname" value="localhost" /></td>
      </tr>
      <tr>
        <td class="bluebold">User Name : </td>
        <td><input name="username" type="text" id="username" value="Username" /></td>
      </tr>
      <tr>
        <td class="bluebold">Password:</td>
        <td><input name="password" type="text" id="password" value="password" /></td>
      </tr>
      <tr>
        <td class="bluebold">Database name: </td>
        <td><input name="databasename" type="text" id="databasename" value="databasename" /></td>
      </tr>
      <tr>
        <td class="bluebold">&nbsp;</td>
        <td><input type="submit" name="createconfig" value="Create"></td>
      </tr>
    </table>
	</form>
	
	</td>
  </tr>
  <tr>
    <td width="36%">&nbsp;</td>
    <td width="64%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

