Hi Jpadie
This is my PHP script where I want to redirect from
<html>
<head>
<title>PHP Mail from GoldMine</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
/******************************************************
*******************************************************
** PHPMailer.php
** written by JCS
** Purpose:
** This script was generated
** with the GoldMine Web Import
** script generator. It will generate
** the INI style of web import data
** and email the results to the contact
** entered in the tool.
**
** WARNING: This script requires that you
** have proper setup of your Apache server to
** A. use PHP
** B. setup of your PHP mailer for your SMTP data.
*******************************************************
*******************************************************
*/
function Decode($strValueIn)
{
//Do not modify this function!
$intX = 0;
$intY = 0;
$Temp = "";
$Mod = "";
$intMod =0;
$intTemp = 0;
$ValueOut = "";
$intY = 1;
$strValueOut="";
for ($intX=1; $intX<=((strlen($strValueIn)/2)/2); $intX=$intX+1)
{
$strTemp="";
$strMod="";
if (($intX % 2)==0)
{
$strMod=substr(substr($strValueIn,$intY-1,4),0,2);
$strTemp=substr(substr($strValueIn,$intY-1,4),strlen(substr($strValueIn,$intY-1,4))-(2));
}
else
{
$strMod=substr(substr($strValueIn,$intY-1,4),strlen(substr($strValueIn,$intY-1,4))-(2));
$strTemp=substr(substr($strValueIn,$intY-1,4),0,2);
}
$intMod=hexdec($strMod);
$intTemp=hexdec($strTemp);
$intTemp=$intTemp-$intMod;
$strValueOut=$strValueOut.chr($intTemp);
$intY=$intY+4;
}
return $strValueOut;
}
if ($_POST["GMsubmit"]!="")
{
$Body = "";
//$SendToEmail = Decode($_POST["SendToEmail"]);
//$SMTP = Decode($_POST["SMTP"]); //Your SMTP data may have to be set set on the Apache Server, and this variable is not used.
$OnNewSendGMEmail = $_POST["OnNewSendGMEmail"];
if ($OnNewSendGMEmail!="")
{$OnNewSendGMEmail = Decode($OnNewSendGMEmail);}
else
{$OnNewSendGMEmail = "";}
if ($_POST["OnDUPSendGMEmail"]!="")
{$OnDUPSendGMEmail = Decode($_POST["OnDUPSendGMEmail"]);}
else
{$OnDUPSendGMEmail = "";}
if ($_POST["OnNewAttachTrack"]!="")
{$OnNewAttachTrack = Decode($_POST["OnNewAttachTrack"]);}
else
{$OnNewAttachTrack = "";}
if ($_POST["OnDupAttachTrack"]!="")
{$OnDupAttachTrack = Decode($_POST["OnDupAttachTrack"]);}
else
{$OnDupAttachTrack = "";}
if ($_POST["Word"]!="")
{$Password = Decode($_POST["Word"]);}
else
{$Password = "";}
if ($_POST["DupLogic"]!="")
{$DupLogic = Decode($_POST["DupLogic"]);}
else
{$DupLogic = "";}
$OutputAs = $_POST["OutPutAs"];
$DuplicateCount=0;
$XML = "<gmdata>";
if ($_POST["DuplicateCount"]!="")
{
$DuplicateCount =intval($_POST["DuplicateCount"]);
}
if ($DuplicateCount >0 || $OnNewSendGMEmail!="" || $OnDUPSendGMEmail!="" ||
$OnNewAttachTrack!="" || $OnDupAttachTrack!="")
{
$Body = $Body."[Instructions]\n";
$XML = $XML."<Instructions>";
if ($DuplicateCount > 0)
{
for($counter=0; $counter < $DuplicateCount; $counter++)
{
$RealCount=$counter+1;
$str = "DuplicateChecking$RealCount";
eval("\$str = \"$str\";");
$Body = $Body."DupCheck".$RealCount."=".$_POST[$str]."\n";
//print($str.":".$_POST[$str].";");
$tempVal = $_POST[$str];
if ($tempVal==="EMAIL")
{
$XML = $XML."<DupCheck>EA1</DupCheck>";
}
else
{
if ($tempVal==="WEBSITE")
{
$XML = $XML."<DupCheck>WS1</DupCheck>";
}
else
{
$XML = $XML."<DupCheck>".htmlspecialchars($_POST[$str])."</DupCheck>";
}
}
}
if ($DupLogic !="")
{$Body = $Body."DupLogic=OR\n";}
}
if ($OnNewSendGMEmail!="")
{
$Body = $Body."OnNewSendGMEmail=".$OnNewSendGMEmail."\n";
$XML = $XML."<OnNewSendGMEmail>".htmlspecialchars($OnNewSendGMEmail)."</OnNewSendGMEmail>";
}
if ($OnDUPSendGMEmail!="")
{
$Body = $Body."OnDUPSendGMEmail=".$OnDUPSendGMEmail."\n";
$XML = $XML."<OnDupSendGMEmail>".htmlspecialchars($OnDUPSendGMEmail)."</OnDupSendGMEmail>";
}
if ($OnNewAttachTrack!="")
{
$comma =strpos($OnNewAttachTrack, ",");
$Body = $Body."OnNewAttachTrack=".$OnNewAttachTrack."\n";
if ($comma =="")
{
$XML = $XML."<OnNewAttachTrack>".htmlspecialchars($OnNewAttachTrack)."</OnNewAttachTrack>";
}
else
{
list($track, $user) = split(',', $OnNewAttachTrack,2);
$XML = $XML."<OnNewAttachTrack User=".chr(34).htmlspecialchars($user).chr(34).">".htmlspecialchars($track)."</OnNewAttachTrack>";
}
}
if ($OnDupAttachTrack!="")
{
$comma =strpos($OnDupAttachTrack, ",");
$Body = $Body."OnDupAttachTrack=".$OnDupAttachTrack."\n";
if ($comma =="")
{
$XML = $XML."<OnDupAttachTrack>".htmlspecialchars($OnDupAttachTrack)."</OnDupAttachTrack>";
}
else
{
list($track, $user) = split(',', $OnDupAttachTrack,2);
$XML = $XML."<OnDupAttachTrack User=".chr(34).htmlspecialchars($user).chr(34).">".htmlspecialchars($track)."</OnDupAttachTrack>";
}
}
if ($Password!="")
{
$Body = $Body."Password=".$Password."\n";
$XML = $XML."<Password>".htmlspecialchars($Password)."</Password>";
}
if ($DupLogic!="")
{
$XML = $XML."<DupLogic>OR</DupLogic>";
}
else
{
$XML = $XML."<DupLogic>AND</DupLogic>";
}
$XML = $XML."</Instructions>";
}
$Body = $Body."[Data]\n";
$XML = $XML."<accounts><account>";
$Phone = "";
$EA = "";
$WS = "";
$PR = "";
while(list($key,$value)= each($_POST))
{
eval("$\$key = \"$value\";");
{
if ($key!="GMsubmit" && $key!="SMTP" && $key!="OnNewSendGMEmail" &&
$key!="OnDUPSendGMEmail" && $key!="OnNewAttachTrack" &&
$key!="OnDupAttachTrack" && $key!="SendToEmail" && $key!="DuplicateCount" && $key!="Word" &&
strpos($key, "DuplicateChecking") === false && $key!="OutPutAs" && $key!="DupLogic" && strpos($key, "pretty_") === false)
{
if($value!="")
{
$Body = $Body.$key."=".$value."\n";
if (substr($key,0,5)!="PHONE" && substr($key,0,3)!="FAX" && substr($key, 0, 5)!="EMAIL" && substr($key,0, 7)!="WEBSITE")
{
$PR = $PR."<property name=".chr(34).$key.chr(34)." db_name=".chr(34).$key.chr(34).">";
$PR = $PR."<property_string>".htmlspecialchars($value)."</property_string>";
$PR = $PR."</property>";
}
else
{
if(substr($key,0,5)=="PHONE")
{
$Phone = $Phone."<phone international=".chr(34)."0".chr(34)." type=".chr(34).$key.chr(34)." source_fld=".chr(34).$key.chr(34).">";
$Phone = $Phone."<properties><property name=".chr(34)."phone_number".chr(34)."><property_string>".$value."</property_string></property></properties>";
$Phone = $Phone."</phone>";
}
elseif(substr($key,0,3)=="FAX")
{
$Phone = $Phone."<phone international=".chr(34)."0".chr(34)." type=".chr(34).$key.chr(34)." source_fld=".chr(34).$key.chr(34).">";
$Phone = $Phone."<properties><property name=".chr(34)."phone_number".chr(34)."><property_string>".$value."</property_string></property></properties>";
$Phone = $Phone."</phone>";
}
elseif(substr($key,0,7)=="WEBSITE")
{
$WS = $WS."<website primary=".chr(34)."1".chr(34)." id=".chr(34)."WS1".chr(34).">";
$WS = $WS."<properties><property name=".chr(34)."web_site".chr(34)."><property_string>".$value."</property_string></property></properties>";
$WS = $WS."</website>";
}
elseif(substr($key,0,5)=="EMAIL")
{
$EA = $EA."<email primary=".chr(34)."1".chr(34)." id=".chr(34)."EA1".chr(34).">";
$EA = $EA."<properties><property name=".chr(34)."email_address".chr(34)."><property_string>".$value."</property_string></property></properties>";
$EA = $EA."</email>";
}
}
}
}
}
}
if ($PR !="")
{$XML = $XML."<properties>".$PR."</properties>";}
if($Phone!="")
{
$XML = $XML."<phone_numbers>".$Phone."</phone_numbers>";
}
if($EA!="")
{
$XML = $XML."<emails>".$EA."</emails>";
}
if($WS!="")
{
$XML = $XML."<websites>".$WS."</websites>";
}
$XML = $XML."</account></accounts></gmdata>";
$ToSubject="Web Import";
//The PHP built in function mail() will not raise or cause errors if it fails - so be sure that your PHP server is setup correctly!
if( $OutputAs!="INI")
{
$Body = $XML;
}
ini_set("SMTP", Decode($SMTP));
if(mail(Decode($SendToEmail), $ToSubject, $Body, "From: GoldMine WebImport <no-reply@frontrange.com>\r\nContent-Type: text/x-gm-impdata\r\n" )) {
print "Your data has been recorded successfully!\n\n<!--\n".Decode($SendToEmail)."\n".$ToSubject."\n".$Body."\n\n".$OutputAs."\n\n-->";
}
else
{print("There was a mailer failure.\n\n<!--\n".$Body."\n\n-->");}
}
else
{echo "There was no form data passed.";}
?>
</body>
</html>