File: /home/austral3d/fourdplan.com/cotizario/welcome.php
<!DOCTYPE html>
<html>
<head>
<title>Product Finder</title>
<?php include "files/functions.php" ?>
<?php $conn = connect_sql() ?>
<?php include "files/functionsJS.php" ?>
</head>
<body>
<?php $origName = $_GET["companyName"]; ?>
<?php
$companyName = format_companyName($origName);
if (!in_array($companyName, get_dbs($conn))) {
create_db($conn, $companyName);
}
mysqli_select_db($conn, $companyName);
?>
<h3>Welcome <?php echo $origName; ?>!</h3>
<br />
<br />
<div id='listSelect' style='display:block'>
<h4>Select master list</h4>
<form action='search.php' method='GET'>
<select name='masterList'>
<option value='' selected>Select product list ...</option>
<?php foreach(get_table_names($conn, $companyName) as $table): ?>
<?php echo $companyName; ?>
<option value=<?php echo $companyName.'-'.$table.'>'.$table ?></option>
<?php endforeach; ?>
<input type='submit' value='Select'/>
</select>
</form>
<br />
<input type='button' value='Upload new file'
onclick='showItem("listUpload");hideItem("listSelect")' />
</div>
<div id='listUpload' style='display:none'>
<h4>Upload new list</h4>
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="productList" id="productList" required>
<?php
list_upload_info('productList');
upload_file('productList');
$file_name = $_FILES['productList']['name'];
create_table_from_file($conn, $file_name, "uploads/".$file_name);
?>
<input type='submit' value='Upload File' />
</form>
<br />
<input type='button' value='Choose from list'
onclick='showItem("listSelect");hideItem("listUpload")' />
</div>
</body>
</html>