<?php
/*
#****************************************************************************#
# Ultimate Locator			                         	     #
# Professional Zip Code Locator Systems          support@ultimatelocator.com #
# Copyright 2004 PageSkills.com Internet Services    www.ultimatelocator.com #
# Release Date: 2/01/2004                                                    #
#                                                                            #
#   Ultimate Locator is protected by the copyright                           #
#   laws and international copyright treaties, as well as other              #
#   intellectual property laws and treaties.                                 #
#   Distribution without approved license is illegal and is                  #
#   punishable by law.                                                       #
#                                                                            #
#   A license is good toward one domain only.  You must purchase             #
#   additional licenses if you wish to install this software on              #
#   additional domains (websites). We do offer Reseller Packages.            #
#****************************************************************************#
*/

header("Cache-control: private");

require_once("admin/config.php");

$fp=fopen("$user_path/visitor_add.htm","r");
$str=fread($fp,filesize("$user_path/visitor_add.htm"));

$str3 = "<script language=\"JavaScript\">

function validateform()
{
//entry validation
	var name = document.form1.name.value;
	var address1 = document.form1.address1.value;
	var address2 = document.form1.address2.value;
	var city = document.form1.city.value;
	var state = document.form1.state.value;
	var other = document.form1.other.value;
	var zip = document.form1.zip.value;
	var telephone = document.form1.telephone.value;
	var fax = document.form1.fax.value;
	var email = document.form1.email.value;
	var website = document.form1.website.value;
	var visitorname = document.form1.visitorname.value;
	var visitoremail = document.form1.visitoremail.value;


	if(name == \"\")
	{
	alert( \"Name field is Blank\");
	document.form1.name.focus();
	return false;
	}



	if(address1 == \"\")
	{
	alert(\"Please Enter the Address\");
	document.form1.address1.focus();
	return false;
	}

	if(city == \"\")
	{
	alert(\"City field is Blank\");
	document.form1.city.focus();
	return false;
	}


	if(state == \"\" && other == \"\")
	{
	alert(\"Select or Enter the State\");
	document.form1.state.focus();
	return false;
	}

	if(state == \"XX\")
	{
	if(other == \"\" )
	{
	alert(\"Please enter a State in the Other box\");
	document.form1.other.focus();
	return false;
	}
	}

	if(other != \"\")
	{
	if(state != \"XX\" )
	{
	alert(\"Please select Other from the State list, if you wish to enter a State\");
	document.form1.state.focus();
	return false;
	}

	}

	
	if(document.form1.country.selectedIndex <= 0)
	{
	alert(\"Select or Enter the country\");
	document.form1.country.focus();
	return false;
	}
	
	if(document.form1.country.value == \"other\")
	{
	  if(document.form1.otherc.value ==\"\")
	  {
	    alert(\"Please enter a Country in the Other box\");
		document.form1.otherc.focus();
		return false;
	  }
	}
	
	
	
	if(zip == \"\")
	{
	alert(\"Please Enter the Zip Code\");
	document.form1.zip.focus();
	return false;
	}

	
	if(telephone == \"\")
	{
	alert(\"Please Enter Phone Number.\");
	document.form1.telephone.focus();
	return false;
	}
	
	if(fax == \"\")
	{
	alert(\"Please Enter fax Number.\");
	document.form1.fax.focus();
	return false;
	}
	
	if(email == \"\")
	{
	alert(\"Please Enter email.\");
	document.form1.email.focus();
	return false;
	}
	
	if(website == \"\")
	{
	alert(\"Please Enter website.\");
	document.form1.website.focus();
	return false;
	}
	
	
	if(document.form1.user1.value == \"\")
	{
	alert(\"Please Enter user1.\");
	document.form1.user1.focus();
	return false;
	}
	
	if(document.form1.user2.value == \"\")
	{
	alert(\"Please Enter user2.\");
	document.form1.user2.focus();
	return false;
	}
	
	if(document.form1.user3.value == \"\")
	{
	alert(\"Please Enter user3.\");
	document.form1.user3.focus();
	return false;
	}
	
	if(document.form1.user4.value == \"\")
	{
	alert(\"Please Enter user4.\");
	document.form1.user4.focus();
	return false;
	}
	
	if(document.form1.user5.value == \"\")
	{
	alert(\"Please Enter user5.\");
	document.form1.user5.focus();
	return false;
	}
	


	return true;
}
</script>";

$st=explode("##", $str);

$userstring="";

if($users1 != "")
{
$userstring.="<tr>
              <td vAlign=\"top\"><font color=\"#000000\" size=\"2\">$users1:</font></td>
              <td vAlign=\"top\" colSpan=\"2\">
              <input name=\"user1\" size=\"20\" maxlength=\"200\"></td>
            </tr>";
}

if($users2 != "")
{
$userstring.="<tr>
              <td vAlign=\"top\"><font color=\"#000000\" size=\"2\">$users2:</font></td>
              <td vAlign=\"top\" colSpan=\"2\">
              <input name=\"user2\" size=\"20\" maxlength=\"200\"></td>
            </tr>";
}

if($users3 != "")
{
$userstring.="<tr>
              <td vAlign=\"top\"><font color=\"#000000\" size=\"2\">$users3:</font></td>
              <td vAlign=\"top\" colSpan=\"2\">
              <input name=\"user3\" size=\"20\" maxlength=\"200\"></td>
            </tr>";
}

if($users4 != "")
{
$userstring.="<tr>
              <td vAlign=\"top\"><font color=\"#000000\" size=\"2\">$users4:</font></td>
              <td vAlign=\"top\" colSpan=\"2\">
              <input name=\"user4\" size=\"20\" maxlength=\"200\"></td>
            </tr>";
}

if($users5 != "")
{
$userstring.="<tr>
              <td vAlign=\"top\"><font color=\"#000000\" size=\"2\">$users5:</font></td>
              <td vAlign=\"top\" colSpan=\"2\">
              <input name=\"user5\" size=\"20\" maxlength=\"200\"></td>
            </tr>";
}


$struser=str_replace("{textboxes}",$userstring,$st[1]);

$s = $st[0].$struser.$st[2];


$str=$s.$str3;

echo $str;

?>




