Guest User

custom php functions

a guest
Mar 7th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.96 KB | None | 0 0
  1. add_filter("gform_confirmation", "idx_redirect", 10, 4);
  2.  
  3. function idx_redirect($confirmation, $form, $lead, $ajax){
  4.     $search_url = save_user_search($lead);
  5.     if($form["id"] == "6")
  6.         {
  7.         $confirmation = array("redirect" => $search_url);
  8.         }
  9.     return $confirmation;
  10. }
  11. function save_user_search ($formData) {
  12.     $idx_area = add_area($formData[54]);
  13.     $idx_type = add_propType($formData[55]);
  14.         $idx_redirect = "http://www.homesforsale.alphainvestments-ct.com/idx/10601/userSaveSearch.php?stp=advanced&idxID=064&pt=sfr&showField=cityField&lp=1000&hp=";
  15.         $idx_redirect .= $formData[44];
  16.         $idx_redirect .= "&ba=0&srt=DESC&start=0&per=25";
  17.         $idx_redirect .= $idx_area;
  18.         $idx_redirect .= $idx_type;
  19.         $idx_redirect .= "&cid10601&savedResultsLink=y";
  20.         return $idx_redirect;
  21. }
  22. function add_area ($area) {
  23.     $idxArea = ( explode (",",$area));
  24.         foreach ($idxArea as $value)
  25.             {
  26.                 $value = "aw_area[]=" . $value;
  27.                 return $value;
  28.                 }
  29.         if ($idxArea[0] == 0)
  30.             {
  31.             $idxArea[0] = "&" . $idxArea[0];
  32.             }
  33.     return implode("&",$idxArea);
  34. }
  35. function add_propType ($property) {
  36.     $propType = array($propType);
  37.     $formProp = array("foreclosure", "short sale", "probate", "fixer upper", "condo", "waterfront", "equestrian", "turn key");
  38.     $idxProp = array("%22bank+owned%22+%22proof+of+funds%22+%22homepath%22+%22hud+home%22+%22hud+property%22+%22hud+owned%22+%22foreclosure%22+%22pre-qual%22+%22prequal%22+%22freddie%22+%22fannie%22+%22pre-approval%22", "%22bank+approval%22+%22shortsale+approval%22+%22short+sale+approval%22+%22lender+approval%22+%22lien+holder+approval%22+%22third+party+approval%22+%223rd+party+approval%22", "%22probate%22+%22estate+property%22");
  39.     $idxType = str_ireplace($formProp, $idxProp, $propType);
  40.         if ($idxType["id"] == 0)
  41.         {
  42.         $idxType[0] = "&kw_remarksConcat=" . $idxType[0];
  43.         }
  44.         return implode("+",$idxType);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment