<form name="form1" method="post" action="index.php?page=install">

<h2>Install - Easy Installation</h2>

<?PHP if (empty($error)) { ?>

<div class="editbox" style="width: 100%; font-size: 14px;"> This is the easiest installation method, but it is not supported by all servers. If this method does not work for you, try the standard installation method instead. Using 

this method, we attempt to automatically create your MySQL database using only your FTP username and password.</div>

<?PHP } ?>

<?PHP if (!empty($error)) { ?>

<div class="editbox" style="width: 100%; font-size: 14px; color: red;"><?php echo $error; ?></div>

<?PHP } ?>

<?php
if ($success != 1) {
	$ourFileName = "../db/mysql.php"; 
	$ourFileHandle = fopen($ourFileName, 'w'); 
	fclose($ourFileHandle);
        $filename = '../db';

        if (!is_writable($filename)) {
?>

<h3 style="margin-top: 15px;">Hold On...</h3>

<div class="primebox" style="width: 100%;"> The directory <b>/webifycore/db</b> is not writable. It will need to be made writable in order to continue this installation. <br>

<br>

CHMOD the /db/ directory to 775 (or 777). <br>

<br>

Go do that, come back, refresh this page and if this error goes away, you are good to go.</div>

<?PHP } ?>

<?PHP if (is_writable($filename)) { ?>

<?PHP
if (!empty($_GET[qun]))
        $_POST[FTPUSER] = $_GET[qun];

if (!empty($_GET[qpw]))
        $_POST[FTPPASS] = $_GET[qpw];

if (!empty($_GET[aun]))
        $_POST[ADMINUSER] = $_GET[aun];

if (!empty($_GET[apw]))
        $_POST[ADMINPASS] = $_GET[apw];

?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size: 12px;">

<tr> 

<td style="padding-right:10px;" width="50%"> 

<h3 style="margin-top: 15px;">FTP Username</h3>

So that we can automatically setup this App, we need your website FTP username. 

<input type="text" name="FTPUSER" class="primebox" style="width: 100%;" value="<?php echo $_POST[FTPUSER]; ?>">

</td>

<td style="padding-left:10px;" width="50%"> 

<h3 style="margin-top: 15px;">FTP Password</h3>

So that we can automatically setup this App, we need your website FTP password. 

<input type="text" name="FTPPASS" class="primebox" style="width: 100%;" value="<?php echo $_POST[FTPPASS]; ?>">

</td>

</tr>

<tr> 

<td style="padding-right:10px;" width="50%"> 

<h3 style="margin-top: 15px;">Database Host</h3> 

This is usually localhost, mysql or an IP number. Try localhost first. 

<?php if (empty($_POST[HOST])) $_POST[HOST] = localhost; ?>

<input type="text" name="HOST" class="primebox" style="width: 100%;" value="<?php echo $_POST[HOST]; ?>">

</td>

<td style="padding-left:10px;" width="50%"> 

<h3 style="margin-top: 15px;">Database Name</h3>

We will attempt to automatically create this database for you.

<?php if (empty($_POST[DBNAME])) $_POST[DBNAME] = webifycore; ?>

<input type="text" name="DBNAME" class="primebox" style="width: 100%;" value="<?php echo $_POST[DBNAME]; ?>">

</td>

</tr>

<tr> 

<td style="padding-right:10px;" width="50%"> 

<h3 style="margin-top: 15px;">Administrator Username</h3>

You can choose any username that you would like. Min 4 characters. 

<input type="text" name="ADMINUSER" class="primebox" style="width: 100%;" value="<?php echo $_POST[ADMINUSER]; ?>">

</td>

<td style="padding-left:10px;" width="50%"> 

<h3 style="margin-top: 15px;">Administrator Password</h3>

You can choose any password that you would like. 

<input type="text" name="ADMINPASS" class="primebox" style="width: 100%;" value="<?php echo $_POST[ADMINPASS]; ?>">

</td>

</tr>

</table>

<div align="center"><input class="sparklybutton" type="submit" name="Install" value="Install" style="margin-top: 15px;"></div>

<?PHP }} ?>

</form>
