} if ($dup_lead < 1) { if (eregi("$phone_number$US$list_id",$phone_list)) {$dup_lead++; $dup++;} } } if ( (strlen($phone_number)>6) and ($dup_lead<1) ) { if (strlen($phone_code)<1) {$phone_code = '1';} $US='_'; $phone_list .= "$phone_number$US$list_id|"; $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### $stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');"; $rslt=mysql_query($stmtZ, $link); if ($WeBRooTWritablE > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; } else { $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),"; $multi_insert_counter++; }
exit; } else { if (strlen($list_id_field) > 0) { $list_id = $list_id_field; } ##### BEGIN insert not-found lead into the system ##### if (strlen($phone_number) < 6 or strlen($phone_number) > 18 or strlen($phone_code) < 1 or strlen($list_id) < 3) { $result = 'ERROR'; $result_reason = "update_lead INVALID DATA FOR LEAD INSERTION"; $data = "{$phone_number}|{$phone_code}|{$list_id}|{$insert_if_not_found}"; echo "{$result}: {$result_reason} - {$user}|{$data}\n"; api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data); exit; } else { ### get current gmt_offset of the phone_number $gmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $tz_method, $postal_code, $owner, $USprefix); if (strlen($status) < 1) { $status = 'NEW'; } ### insert a new lead in the system with this phone number $stmt = "INSERT INTO vicidial_list SET phone_code='{$phone_code}',phone_number='{$phone_number}',list_id='{$list_id}',status='{$status}',user='******',vendor_lead_code='{$vendor_lead_code}',source_id='{$source_id}',gmt_offset_now='{$gmt_offset}',title='{$title}',first_name='{$first_name}',middle_initial='{$middle_initial}',last_name='{$last_name}',address1='{$address1}',address2='{$address2}',address3='{$address3}',city='{$city}',state='{$state}',province='{$province}',postal_code='{$postal_code}',country_code='{$country_code}',gender='{$gender}',date_of_birth='{$date_of_birth}',alt_phone='{$alt_phone}',email='{$email}',security_phrase='{$security_phrase}',comments='{$comments}',called_since_last_reset='N',entry_date='{$ENTRYdate}',last_local_call_time='{$NOW_TIME}',rank='{$rank}',owner='{$owner}',entry_list_id='0';"; if ($DB > 0) { echo "DEBUG: update_lead query - {$stmt}\n"; } $rslt = mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { $lead_id = mysql_insert_id($link); $result = 'SUCCESS'; $result_reason = "update_lead LEAD HAS BEEN ADDED"; echo "{$result}: {$result_reason} - {$phone_number}|{$list_id}|{$lead_id}|{$gmt_offset}|{$user}\n";