<?php
	session_start();
	include "../correlations/includes.php";
	$ME = "techsupportform.php";
	
	// list of all fields to pick up using $_POST
	$allfields = array(	"date", "product", "OS", "type", "version", "regnum", "firstname", "lastname", "state", "phone", "email", "description", "bfield");
	
	// list of all required fields on the form
	$required  = array(	"product", "OS", "type", "version", "regnum", "firstname", "lastname", "state", "phone", "email", "description");
	
	if (isset($_POST['Submit']))
	{
		// capture the posted values in Session variables
		foreach($allfields as $field) {
			$_SESSION[$field] = @$_POST[$field];
		}

		// check for required fields
		$_SESSION['errors'] = "";
		foreach($required as $field) {
			if (!$_POST[$field])
			{
				$_SESSION['errors'] .= "	- $field is a required field <br>";
			}
		}
 
		// check for valid email address
		if (!isValidEmail($_SESSION['email'])) {
			$_SESSION['errors'] .= " Invalid email address - please reenter <br>";
		}

		// check the invisible robot discovery field
		if (!$_SESSION['bfield'] === "")
		{
			// create an entry in the search log file
			$Line = date('m/d/y H:i:s') . '  ' . $ME . ' bfield = ' . $_SESSION['bfield'];
			$logfile = "../../logs/bots.txt";
			$fp = fopen($logfile, "a");
			fwrite($fp, $Line . "\r\n");
			fclose($fp);
			
			// get out now
			exit;
		}

		// check if bot put an email address in the regnum field
		if (!strstr($_SESSION['regnum'], "@") === FALSE)
		{
			// create an entry in the search log file
			$Line = date('m/d/y H:i:s') . '  ' . $ME . ' regnum = ' . $_SESSION['regnum'];
			$logfile = "../../logs/bots.txt";
			$fp = fopen($logfile, "a");
			fwrite($fp, $Line . "\r\n");
			fclose($fp);
			
			// get out now
			exit;
		}
		
		// if all fields OK
		if ($_SESSION['errors'] == "")
		{
			// start the page to email the form
			$_SESSION['date'] = date('m/d/y H:i:s');
			header("Location: techsupportfinish.php");
			exit;
		}
	}
	else
	{
		$_SESSION['errors'] = "";
		$_SESSION['bfield'] = "";
	}
?>

<!DOCTYPE html>
<html>

<head>

<title>Tech Support Form</title>

<meta name="description" content="Harmonic Vision is the developer and publisher of the Music Ace series of music education software.">
<meta name="keywords" content="music education, piano lessons, music education software, music theory, learning music, music lessons, beginning music, music software, Music Ace, Music Doodle Pad, Music Ace 2, Music Ace Deluxe, Music Ace Maestro">

<link rel="stylesheet" href="../css/styles.css" type="text/css">

<style type="text/css">
.style26 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}
.style27 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	background-color: #FFFFFF;
}
.style30 {font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #FF0000;}
.style31 {font-size: 10px}
.style33 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	line-height: normal;
}
.styleRED {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FF0000;
}
</style>
</head>

<body>
<br>  <!--  <br> to push the whole page down 1 line from the browser top  -->

<!-- ===============================  start page container table (entire page is enclosed by this table) ===== -->
<table border="1" cellpadding="0" cellspacing="0" width="800" align="center" bgcolor="#fffffe"><tr><td valign="top">

<!-- =================================== start Logo Header ======================================= --><!-- #BeginLibraryItem "/Library/header.lbi" -->
<table width="788" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr><td><img src="../images/spacer.gif" alt="" width="784"  height="5"></td></tr>
  <tr><td><img src="../images/insidetop.gif" alt="" width="784"  height="57"></td></tr>
</table>
<!-- #EndLibraryItem --><!-- =================================== end Logo Header ======================================= -->

<!-- =================================== start Navigation Buttons ======================================= --><!-- #BeginLibraryItem "/Library/navbuttons.lbi" --><table width="771" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td>
  <div class="navBar"" align="left">
    <ul id="nav">
	<li><a href="#">Products</a>
		<ul>
			<li><a href="../madfact.htm">Music Ace Deluxe</a></li>
			<li><a href="../mamfact.htm">Music Ace Maestro</a></li>
			<li><a href="../mafact.htm">Music Ace</a></li>
			<li><a href="../ma2fact.htm">Music Ace 2</a></li>
			<li><a href="../pafact.htm">Piano Ace</a></li>
			<li><a href="../mampupg.htm">Product Upgrades</a></li>
		</ul>
	</li>
	
	<li><a href="#">At Home</a>
		<ul>
			<li><a href="../hs/index.htm">Homeschool</a></li>
			<li><a href="../products_home.htm">Individual or family</a></li>
			<li><a href="../pianostudent/index.htm">Piano Student</a></li>
		</ul>
	</li>
    	
	<li><a href="#">School</a>
		<ul>
			<li><a href="../products_edu.htm">Products</a></li>
			<li><a href="../educatorresources.htm">Resources</a></li>
		</ul>
	</li>	
	
	<li><a href="#">Studio</a>
       <ul>
            <li><a href="../pianoteacher/index.htm">Studio Teachers</a></li>
			<li><a href="../educatorresources.htm">Resources</a></li>
       </ul>
	</li>
			
	<li><a href="../mampupg.htm">Upgrades</a></li>	
    
	<li><a href="#">Support</a>
      <ul>
            <li><a href="../techsupport/index.htm">Technical Support</a></li>
            <li><a href="registerform.php">Register Product</a></li>
            <li><a href="../dealer.htm">Dealer support</a></li>
            <li><a href="../news.htm">Press/media</a></li>
            <li><a href="../contactus.php">Contact Us</a></li>
       </ul>
    </li>	
    
	<li><a href="demoform.php">Free Demo</a></li>
  </ul>
  </div>
</td></tr></table>
<!-- #EndLibraryItem --><!-- =================================== end Navigation Buttons ======================================= -->

<!-- ========================== start Breadcrumb - update this for each page  ============ -->
<table width="771" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
<div id="breadcrumb"><a href="../index.htm">Home</a>&gt; Support &gt;<a href="../techsupport/index.htm">Technical Support </a>&gt; Submit Report</div>
    </td>
  </tr>
</table>
<!-- ================================= end Breadcrumb ==================================== -->

<!-- ================================= Start Content container table ================================== -->
  <div><table border="0" cellpadding="0" cellspacing="0" width="784" bgcolor="#FFFFFF" align="center"><tr><td>
	 
<!-- ============================== START CONTENT - put page content here =============================== -->	 
		 
<table  width="662" border="0" align="center" cellpadding="0" style="border-collapse: collapse">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="94%"><span class="verdana-11">To report a problem with a Music Ace product, please 
              fill out the  form below and click the&nbsp; &quot;<strong>Submit</strong>&quot; button at the bottom of 
              the page. Please provide as much  information as possible about the problem in the description field. </span><br><br>
            </td>
  </tr>
</table>

<table width="581" border="1" align="center" cellpadding="10" cellspacing="0">
  <tr><td><table width="498" align="center">
      <tr><td width="495">

<form name="form1" method="post" action="<?php echo $ME; ?>">
<?php
//-------------------------------------------------------------------------------
// if missing fields were detected, display a table with all the missing fields
//-------------------------------------------------------------------------------
if ($_SESSION['errors'] <> "") {
    echo '<table width="600" border="1" bordercolordark="#000000"><tr>
            <td width="500"><span class="styleRED">Required fields are missing - please complete the fields and Submit again <br>' . $_SESSION['errors'] . '</span></td></tr></table>';}

//-------------------------------------------------------------------------------
?>
          <span class="verdana-11 style30 style31"> * required field </span>
          <table width="489" border="0"><tr>
              <td class="verdana-11">Select your product <span class="style30">*</span> </td>
              <td class="verdana-11">Select your Operating System<span class="style30">*</span> </td></tr>
            
			<tr><td class="style27"><select name="product" size="1" class="verdana-11" id="product" style="font-family: Arial" >
<?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the product select option list from the $product array
//------------------------------------------------------------------------------------------------------
$product= array (	"" => "", "Music Ace" => "Music Ace", "Music Ace 2" =>"Music Ace 2",
				 "Music Ace Starter" => "Music Ace Starter", "Music Ace Deluxe" => "Music Ace Deluxe", "Music Ace Maestro" => "Music Ace Maestro");
foreach($product as $field => $label) {
	echo '<option value="' . $field . '"'; if(@$_SESSION['product'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
              </select>
               </td>
              <td><select name="OS" size="1" class="verdana-11" id="OS" style="font-family: Arial" >
                <?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the OS select option list from the $OS array
//------------------------------------------------------------------------------------------------------
$OS= array (	"" => "", 
		//"Win98" => "Windows 98", 
		//"WinMe" =>"Windows Me", 
		//"WinNT4" =>"Windows NT4", 
		//"Win2000" =>"Windows 2000",
		"WinXP" => "Windows XP", 
		"WinVista" => "Windows Vista", 
		"Win7" => "Windows 7", 
		"Win8" => "Windows 8",
		"Win10" => "Windows 10",
		//"MacOS8" => "Macintosh System 8",  
		//"MacOS9" => "Macintosh System 9 or earlier",
		//"MacOSX_10_4" => "Macintosh OSX 10.4, Tiger or earlier",
		"MacOSX_10_5" => "Macintosh OSX 10.5, Leopard",
		"MacOSX_10_6" => "Macintosh OSX 10.6, Snow Leopard",
		"MacOSX_10_7" => "Macintosh OSX 10.7, Lion",
		"MacOSX_10_8" => "Macintosh OSX 10.8, Mountain Lion",
		"MacOSX_10_9" => "Macintosh OSX 10.9, Mavericks",
		"MacOSX_10_10" => "Macintosh OSX 10.10, Yosemite",
		"MacOSX_10_11" => "Macintosh OSX 10.11, El Capitan",
		"MacOSX_10_12" => "Macintosh OSX 10.12, Sierra",
		"MacOSX_10_13" => "Macintosh OSX 10.13, High Sierra"
);

foreach($OS as $field => $label) {
	echo '<option value="' . $field . '"'; if(@$_SESSION['OS'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
              </select></td></tr>
            
			<tr><td><span class="verdana-11">Select the product version</span><span class="style30">*</span></td>
              <td class="verdana-11">Select the product type <span class="style30">*</span></td></tr>
            
			<tr>
			  <td><select name="version" size="1" class="verdana-11" id="select2" style="font-family: Arial" >
                <?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the version select option list from the $product array
//------------------------------------------------------------------------------------------------------
$version= array (	
		"" => "", 
		"VNONE" => "None", 
		"v2.0" =>"Educator v2.0",
		"v3.0" => "v3.0", 
		"v3.1" => "v3.1", 
		"v3.1.3" => "v3.1.3", 
		"v4.0" => "v4.0", 
		"v5.0" => "v5.0",
		"v5.1" => "v5.1",
		"v5.2" => "v5.2"
);

foreach($version as $field => $label) {
	echo '<option value="' . $field . '"'; if(@$_SESSION['version'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
              </select></td>
              <td class="style27"><select name="type" size="1" class="verdana-11" id="select" style="font-family: Arial" >
                <?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the product type select option list from the $type array
//------------------------------------------------------------------------------------------------------
$type= array (	"" => "", "Consumer" => "Consumer (retail box) edition", "SingleED" =>"Educator edition for a single computer",
				 "LabPack" => "Lab Pack edition for multiple computers", "Network" => "Network edition");
foreach($type as $field => $label) {
	echo '<option value="' . $field . '"'; if(@$_SESSION['type'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
              </select>              </td>
            </tr>
            <tr>
              <td class="verdana-11">Registration Number <span class="style30">*</span>(<a href="regnohelp.htm" target="_blank">help</a>)</td>
              <td class="verdana-11">E-Mail Address<span class="style30">*</span></td>
            </tr>
            <tr>
              <td><input name="regnum" type="text" class="verdana-11" value="<?php echo @$_SESSION['regnum'];?>" size="25" maxlength="25"></td>
              
			  <td><input name="email" type="text" class="verdana-11" id="email" size="30" value="<?php echo @$_SESSION['email'];?>"></td>
            </tr>
            <tr>
              <td class="verdana-11">First name<span class="style30">*</span></td>
              <td><span class="verdana-11">Last name<span class="style30">*</span></span></td>
            </tr>
            <tr>
              <td class="style26"><input name="firstname" type="text" class="verdana-11" id="firstname" size="22" value="<?php echo @$_SESSION['firstname'];?>">               </td>
              <td><input name="lastname" type="text" class="verdana-11" id="lastname" size="30" value="<?php echo @$_SESSION['lastname'];?>"></td>
            </tr>
            <tr>
              <td width="226" align="left" class="verdana-11">Phone: <span class="style30">*</span></td>
              <td width="253" class="verdana-11">State<span class="style30">*</span></td>
            </tr>
            <tr>
              <td width="226" class="style27"><input name="phone" type="text" class="verdana-11" id="phone" value="<?php echo @$_SESSION['phone'];?>" size="20"></td>
              <td width="253" class="style27"><select name="state" size="1" class="verdana-11" id="state">
                <?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the State/Province select option list from the $state array
//------------------------------------------------------------------------------------------------------
$state= array (	""  => "",
				" " => "outside USA/Canada",
				"AL" => "Alabama", "AK" => "Alaska", "AB" => "Alberta", "AS" => "American Samoa" , "AZ" => "Arizona",
				"AR" => "Arkansas", "BC" => "British Columbia", "CA" => "California", "CO" => "Colorado", "CT" => "Connecticut", 
				"DE" => "Delaware", "DC" => "Dist.of Columbia", "FL" => "Florida", "GA" => "Georgia",
				"GU" => "Guam", "HI" => "Hawaii", "ID" => "Idaho", "IL" => "Illinois",
				"IN" => "Indiana", "IA" => "Iowa", "KS" => "Kansas", "KY" => "Kentucky",
 				"LA" => "Louisiana", "ME" => "Maine", "MB" => "Manitoba", "MH" => "Marshall Islands",
 				"MD" => "Maryland", "MA" => "Massachusetts", "MI" => "Michigan", "MN" => "Minnesota",
 				"MS" => "Mississippi", "MO" => "Missouri", "MT" => "Montana", "NE" => "Nebraska",
 				"NV" => "Nevada", "NB" => "New Brunswick", "NH" => "New Hampshire", "NJ" => "New Jersey",
 				"NM" => "New Mexico", "NY" => "New York", "NF" => "Newfoundland", "NC" => "North Carolina",
 				"ND" => "North Dakota", "NT" => "Northwest Terr.", "NS" => "Nova Scotia", "OH" => "Ohio",
 				"OK" => "Oklahoma", "ON" => "Ontario", "OR" => "Oregon", "PW" => "Palau Island",
 				"PA" => "Pennsylvania", "PE" => "Prince Edward Is.", "PR" => "Puerto Rico", "QC" => "Quebec",
 				"RI" => "Rhode Island", "SK" => "Saskatchewan", "SC" => "South Carolina", "SD" => "South Dakota",
 				"TN" => "Tennessee", "TX" => "Texas", "UT" => "Utah", "VT" => "Vermont",
 				"VI" => "Virgin Islands", "VA" => "Virginia", "WA" => "Washington", "WV" => "West Virginia",
 				"WI" => "Wisconsin", "WY" => "Wyoming", "YT" => "Yukon Territory");

foreach($state as $field => $label) {
	echo '<option value="' . $field . '"'; if(@$_SESSION['state'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
              </select>              </td>
            </tr>
              <td colspan="2"><span class="verdana-11">Description of the problem </span><span class="style30">*
 
 <!-- The following code is invisible to humans and contains some trap text fields                -->
		<div style="display: none">
		If you can read this, don't touch the following text fields.<br>
		<input type="text" name="bfield" size="10" value="<?php echo $_SESSION['bfield'];?>"><br>
		</div>
		
              </span></td>
            </tr>
            <tr>
              <td colspan="2"><div align="left">
                <textarea name="description" cols="78" rows="6" class="verdana-11"><?php echo @$_SESSION['description'];?></textarea>
              </div></td>
            </tr>
          </table>
          <div align="center">
            <input type="submit" name="Submit" value="Submit">
          </div>
        </form>
		
		</td></tr>
    </table></td>
  </tr>
</table>
<br>
<!-- ==============================   END CONTENT ====================================================== -->

<!-- ================================= End Content container table ================================== -->
  </td></tr></table></div>
  
<!-- ================================= start Footer ============================================ --><!-- #BeginLibraryItem "/Library/footer.lbi" --><table width="771" border="0" cellspacing="0" cellpadding="0" align="center" class="footer">
  <tr>
    <td>
       <div id="footernav">
          <a href="../index.htm" target="_parent">Home</a>
          <a href="../privacy.htm" target="_parent">Privacy Policy</a>
          <a href="../contactus.php" target="_parent">Contact Us</a></div>
       <div align="center">Copyright &copy; 2013 Harmonic Vision Inc.<br><br></div>
	</td>
  </tr>
</table>
<!-- #EndLibraryItem --><!-- ===============================  end Footer =============================================== -->

<br>

<!-- ==============================  close container table ======================== -->
</tr></td></table>

</body>
</html>
