Register
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$m = array();
$values = array();
$yesnoFields = array();
$values["Number"]=$_REQUEST["f671673"];
$values["Name"]=$_REQUEST["f671674"];
if ($values["Name"] == "")
{
$m[] = "Name";
}
$values["Street"]=$_REQUEST["f671676"];
$values["City"]=$_REQUEST["f671677"];
$values["State"]=$_REQUEST["f671678"];
$values["Zip"]=$_REQUEST["f671679"];
$values["Country"]=$_REQUEST["f671680"];
if ($values["Country"] == "")
{
$m[] = "Country";
}
$values["Phone"]=$_REQUEST["f671682"];
$values["Toll Free"]=$_REQUEST["f671683"];
$values["Fax"]=$_REQUEST["f671684"];
$values["E-mail"]=$_REQUEST["f671685"];
$values["Url"]=$_REQUEST["f671686"];
$values["Contact Name"]=$_REQUEST["f671687"];
$values["Contact Position"]=$_REQUEST["f671688"];
$values["Highlight"]=$_REQUEST["f671689"];
$values["Additional Info"]=$_REQUEST["f671692"];
$sv = array();
$values["SPECIALTIES"] = implode(";", $sv);
if (count($m) > 0)
{
$error = implode(“, “, $m).(count($m) > 1 ? ” fields are required.” : ” field is required.”);
}
else
{
$filepath = realpath(tempnam($_ENV[‘TMP’], “xlocatorlocation”));
$f = fopen($filepath, “w”);
fputcsv($f, array_keys($values), “,”);
fputcsv($f, array_values($values), “,”);
fclose($f);
$c = curl_init(“https://app.xtremelocator.com/siteAdmin/directImport.php”);
$xval = array(
“id” => “10826”,
“type” => “append”,
“file” => “@$filepath”
);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $xval);
ob_start();
curl_exec($c);
$response = ob_get_contents();
ob_end_clean();
// send e-mail notification
$body = “New location registered:\n\n”;
foreach ($values as $k => $v)
{
if ($v != “” || in_array($k, $yesnoFields))
{
if (in_array($k, $yesnoFields))
{
$v = $v > 0 ? “Yes” : “No”;
}
if ($k == “SPECIALTIES”)
{
$vv = explode(“;”, $v);
foreach ($vv as $v)
{
$body .= “$v: Yes\n”;
}
}
else
{
$body .= “$k: $v\n”;
}
}
}
$email = “dave@kandpengineering.com”;
$from = $email;
mail(“$email”, “New location registered”, $body, “From: $from\nReply-To: $from”);
$message = “Registration Successful”;
}
}
?>