$valuep) {
global ${$keyp};
if(!is_array($_POST[$keyp])) {
if(get_magic_quotes_gpc()) ${$keyp} = stripslashes($valuep);
else ${$keyp} = $valuep;
}
${$keyp}=urldecode(${$keyp});
${$keyp}=str_replace("'","''",${$keyp});
}
}
if(isset($_GET)) {
foreach($_GET as $keyg => $valueg) {
global ${$keyg};
if(!is_array($_GET[$keyg])) {
if(get_magic_quotes_gpc()) ${$keyg} = stripslashes($valueg);
else ${$keyg} = $valueg;
}
${$keyg}=urldecode(${$keyg});
${$keyg}=str_replace("'","''",${$keyg});
}
}
if(isset($_REQUEST)) {
foreach($_REQUEST as $keyr => $valuer) {
global ${$keyr};
if(!is_array($_REQUEST[$keyr])) {
if(get_magic_quotes_gpc()) ${$keyr} = stripslashes($valuer);
else ${$keyr} = $valuer;
}
${$keyr}=urldecode(${$keyr});
${$keyr}=str_replace("'","''",${$keyr});
}
}
if($p4=="4"){
$clientID="1006"; // SLE - self generated
$timenow=time();
$FirstName=$fname; SESSION_REGISTER("Fname");$_SESSION[Fname]=$fname;
$LastName=$lname;
$Email=$email;
$PrimaryPhone=$phone1;
$SellTimeFrame=$sellingtimeframe;
$ReasonSelling=$selling_reason;
$Address=$address;
$City=$city;
$State=$state;
$Zip=$zip;
$PropertyType=$propertytype;
if($behind=="Yes"){$LoanStatus="Behind";}else{$LoanStatus="NOT behind";}
$Bedrooms=$beds;
$Bathrooms=$baths;
$LoanAmount=$loanbalance;
$AskingPrice=$asking_price;
$EstimatedValue=$estimatedvalue;
$IsCurrentlyListed=$is_listed;
// Quality Check on leads
if($IsCurrentlyListed=="Yes"){ $HOLD="YES"; }else{ $HOLD="NO"; }
// $PublisherID=$
$SecondaryPhone=$secondaryphone;
// $BestContactTime=$
// $WantsRealtor=$
// $HalfBathrooms=$
$SqFt=$sqft;
// $YearAcquired=$
// $AdditionalNotes=$
// $InterestedInBuying=$
/* Before we add this lead - lets DUP check to avoid DUPS - duh */
$id="";
$sqld="SELECT * from dup_All_Leads where Email='".$Email."' OR PrimaryPhone='".$PrimaryPhone."' ";
$resultd = mysql_query($sqld);
$rowd = mysql_fetch_array($resultd);
$id=$rowd[id];
if($id!=""){ $dupstatus="0";} // so .. if an id is present then a record was found - hense DUP set to 0
else{
$dupstatus="1";
$skip="0";
// build SLE id number
$sql3="SELECT count(id) from MasterLeads where clientID='".$clientID."' ";
$result3 = mysql_query($sql3);
$row3 = mysql_fetch_array($result3);
$sleCount=$row3['count(id)'];
$newcount=($sleCount+1);
$UserID="SLE-".$newcount;
// Update MasterLeads table
// get county
$sql="SELECT * from $zipTable where ZipCode='".$zip."' order by ZipCode ASC";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$county=$row[County];
$state2=$row[State];
/* LET's VALIDATE SOMESTUFF ' */
// if county does not exist ... then thuis is a boggus lead
if($county=="" || !$county){ $skip="1";}
// if a boggus zip or state is entered - this will catch it
if($state2!="$State"){$skip="1";}
// now lets do some other clean up to filter boggus data
$trimmedAddress = trim($Address);
if($trimmedAddress==""){ $skip="1";}
$trimmedCity = trim($City);
if($trimmedCity==""){ $skip="1";}
$trimmedState = trim($State);
if($trimmedState==""){ $skip="1";}
$trimmedZip = trim($Zip);
if($trimmedZip==""){ $skip="1";}
// see if first and last names are the same
if($FirstName=="$LastName"){$skip="1";}
// validate email
$emailValidate = filter_var($Email, FILTER_SANITIZE_EMAIL);
if (!filter_var($emailValidate, FILTER_VALIDATE_EMAIL)) {
$errors .= "$Email is NOT a valid email address.
";
$skip="1";
}
// does phone have too many numbers (greater than 10)
// remove leading 1 if present
$PrimaryPhone = ltrim($PrimaryPhone, "1");
if (strlen($PrimaryPhone)>="11"){$skip="1";}
if($skip=="0")
{
$IP = $_SERVER["REMOTE_ADDR"];
mysql_query("INSERT INTO MasterLeads (referenceid,clientID,LeadSoldTo,ppc_source,FirstName,LastName,Email,PrimaryPhone,SellTimeFrame,ReasonSelling,Address,City,State,Zip,countrycode,county,PropertyType,Bedrooms,Bathrooms,LoanAmount,LoanStatus,AskingPrice,EstimatedValue,IsCurrentlyListed,PublisherID,SecondaryPhone,BestContactTime,WantsRealtor,HalfBathrooms,SqFt,YearAcquired,AdditionalNotes,InterestedInBuying,date,HOLD,IP)
VALUES('$UserID','$clientID','0','$leadsourceid','$FirstName','$LastName','$Email','$PrimaryPhone','$SellTimeFrame','$ReasonSelling','$Address','$City','$State','$Zip','USA','$county','$PropertyType','$Bedrooms','$Bathrooms','$LoanAmount','$LoanStatus','$AskingPrice','$EstimatedValue','$IsCurrentlyListed','$PublisherID','$SecondaryPhone','$BestContactTime','$WantsRealtor','$HalfBathrooms','$SqFt','$YearAcquired','$AdditionalNotes','$InterestedInBuying','$timenow','$HOLD','$IP') "); // or die("A MySQL error has occurred on insert MasterLeads.
Error: (" . mysql_errno() . ") " . mysql_error());
// Dup table as well
mysql_query("INSERT INTO dup_All_Leads (referenceid,clientID,LeadSoldTo,FirstName,LastName,Email,PrimaryPhone,SellTimeFrame,ReasonSelling,Address,City,State,Zip,countrycode,county,PropertyType,Bedrooms,Bathrooms,LoanAmount,LoanStatus,AskingPrice,EstimatedValue,IsCurrentlyListed,PublisherID,SecondaryPhone,BestContactTime,WantsRealtor,HalfBathrooms,SqFt,YearAcquired,AdditionalNotes,InterestedInBuying,date,IP)
VALUES('$UserID','$clientID','0','$FirstName','$LastName','$Email','$PrimaryPhone','$SellTimeFrame','$ReasonSelling','$Address','$City','$State','$Zip','USA','$county','$PropertyType','$Bedrooms','$Bathrooms','$LoanAmount','$LoanStatus','$AskingPrice','$EstimatedValue','$IsCurrentlyListed','$PublisherID','$SecondaryPhone','$BestContactTime','$WantsRealtor','$HalfBathrooms','$SqFt','$YearAcquired','$AdditionalNotes','$InterestedInBuying','$timenow','$IP') "); // or die("A MySQL error has occurred on insert to dup_All_Leads
Error: (" . mysql_errno() . ") " . mysql_error());
// insert lead into leadPurchased table for our own tracking of ROI in PPC
$timerightnow=date("Y-m-d h:i:s",$timenow);
mysql_query("INSERT INTO leadsPurchased (clientID,referenceid,companyName,datePurchased,unixtime,leadPrice,LeadSoldTo)
VALUES('$clientID','$UserID','SLE','$timerightnow','$timenow','0.00','0') ");// or die("A MySQL error has occurred on insert to leadsPurchased.
Error: (" . mysql_errno() . ") " . mysql_error());
}// close if skip==0
// $success="YEP - got it!";
}// not a dup - so iinsert above
// update end URL blow and uncomment after testing
header("Location: thankyou.php");
exit;
}// close form processing
//########################################################################### done lead processing above
$IP = $_SERVER["REMOTE_ADDR"];
// Track Geolocation of visitor
$IPstuff=do_IPdatanow($IP);
// returns this --> $IPstuff = array ("$countrycode","$countryname","$city","$stateabrev","$statename","$latitude","$longitude","$postalcode");
$countrycode=$IPstuff[0];
$lccountrycode=strtolower($countrycode);
$countryname=$IPstuff[1];
$city=$IPstuff[2];
$stateabrev=$IPstuff[3];
$statename=$IPstuff[4];
$latitude=$IPstuff[5];
$longitude=$IPstuff[6];
$postalcode=$IPstuff[7];
$areacode=$IPstuff[8];
$Fname=$_SESSION[Fname];
?>
|
|||
Fill out the 30 second sellers request form to
|
|