0){$i++;continue;} break; } if($i>19) return false;else return $theNewID; } function randomAN($len){// returns random alphanumeric id of length = $len $rangeMin = pow(36, $len-1); //smallest number to give length digits in base 36 $rangeMax = pow(36, $len)-1; //largest number to give length digits in base 36 $base10Rand = mt_rand($rangeMin, $rangeMax); //get the random number $newRand = base_convert($base10Rand, 10, 36); //convert it return $newRand; } if($cln_cmd=='98a9' && isset($cln_condolenceid)){ $includedByFuneralProgram=true; require_once ZDEF_PATH_TO_HUB_ACCOUNT.'pdserver/funeral.def.inc.php'; // this connects to the database, does equivalent of dbIni(); $sql = 'UPDATE '.$funDataBase.'.condolence SET condolence_approved=\'Y\', condolence_approved_datetime = NOW() WHERE condolence_id = \''.$cln_condolenceid.'\''; $r=dbQry($fdb,$sql,'funob32',true); echo '

Condolence Approved

'; die; } if(isset($cln_tkn)){// we always send a form tkn so if there is no tkn this is just a request for the blank form if(array_key_exists('g-recaptcha-response',$_POST) && $_POST['g-recaptcha-response']!='')$captcha=$_POST['g-recaptcha-response'];else $captcha=false; if($captcha){ $secret = '6LdrHYkUAAAAAHfkZwdaQlG5e1-BAPqyncCTA8xx'; $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=.$secret.&response=".$captcha."&remoteip=".ZDEF_REQUESTING_IP); if($response.success==false){$SPAMresult='SPAM: reCaptcha Failure';} }else{ $error='Please check the checkbox at the bottom of the form to prove you aren\'t a robot'; } ob_start(); $response=array(); // right here we check for links in the message or the name to prevent spam // $cln_message='this is the message and i am a spammy link'; if(!empty($error)||!empty($warning)){ $errorReply='

'; if(!empty($error))$errorReply.='Error';if(empty($error)&&!empty($warning))$errorReply.='Warning';$errorReply.='

'.$error.$warning.'

'; $xjs[]=array( 'func'=>'ctf_err', 'parm'=>$errorReply ); $response['xjs']=$xjs; }elseif(strlen($cln_ctf_message)>0){// a condolence has been submitted $includedByFuneralProgram=true; require_once ZDEF_PATH_TO_HUB_ACCOUNT.'pdserver/funeral.def.inc.php'; // this connects to the database, does equivalent of dbIni(); $x=dbEsc($fdb,str_replace('
','
',nl2br($cln_ctf_message)));$y=dbEsc($fdb,$cln_ctf_full_name); $sql = 'SELECT * FROM '.$funDataBase.'.condolence WHERE (condolence$notice_id = \''.$cln_service.'\' AND condolence_message = \''.$x.'\' AND condolence_from_name = \''.$y.'\')'; $r=dbQry($fdb,$sql,'funob33',true); if(dbNR($r)==0){ // this prevents duplicate entries from being processed $theNewID=newID(11,$funDataBase,'condolence','condolence_id',$fdb); $sql = 'INSERT INTO '.$funDataBase.'.condolence (condolence_id,condolence$notice_id,condolence_message,condolence_from_name,condolence_approved) VALUES (\''.$theNewID.'\',\''.$cln_service.'\',\''.$x.'\',\''.$y.'\',\'No\')'; $r=dbQry($fdb,$sql,'funob34',true); $sql = 'SELECT * FROM '.$funDataBase.'.notice WHERE notice_id = \''.$cln_service.'\''; $r=dbQry($fdb,$sql,'fw93s',true); $row=dbRN($r); $deceased=$row['notice_last_name'].', '.$row['notice_first_name'].' '.$row['notice_middle_name']; $mContent.='Condolence for '.$deceased.'

'; $mContent.='Submit Date: '.date("F j, Y").'

'; $mContent.='Senders Name: '.$cln_ctf_full_name.'

'; $mContent.='Condolence:
'.nl2br($cln_ctf_message).'


'; $mContent.='To approve this condolence click here.

'; $mContent.='Warm Regards,

'; $mContent.='Your Website
'; $Mail_sub = 'Condolence From Website ('.$theNewID.')';// the cid makes the message subject unique so email programs that group emails as conversations won't hide the email content $output= '

We have received your condolence...

Thank you'; if(ZDEF_TEST==1){ if($SPAMresult)$output.= '

SPAM DETECTED NO MESSAGE SENT
'.$SPAMresult; else $output.='
Test Mode: recipients would have been '.$zAdminEmail; } $output.= '.

'; if(ZDEF_TEST==1)$zAdminEmail='admin@dyna.digital'; sendMail('Your Website',$zDoNotReply,$zAdminEmail,$Mail_sub,$mContent) ; $response['ib']=array( 'ib'=>'ctf_ib', 'html'=>$output ); } } }else{ /* we just want the html echo'd into the WebPage or WebPageX response */ $required_fields=explode(',',ORG_CONTACT_REQUIRED_FIELDS); $get_fields=explode(',',ORG_CONTACT_GET_FIELDS); $cln_message='';$cln_email_address='';$cln_full_name=''; if(isset($cln_tkn)){ $output= '

We have received your condolence...

Thank you for contacting
'.ORG_ORGANIZATION_SHORT_NAME; if(ZDEF_TEST==1){ if($SPAMresult)$output.= '

SPAM DETECTED NO CONDOLENCE SENT
'.$SPAMresult; else $output.='
Test Mode: recipients were '.$recipients; } $output.= '.

'; $response['ib']=array( 'ib'=>'ctf_ib', 'html'=>$output ); }else{ $forms_php_required='token'; require ZDEF_PATH_TO_LIBRARY.'forms.php.php'; $token=token('ctf_');// this sets $_SESSION['ctf_tkn'] echo '';// the sesssion variable has the prefix: ctf_tkn, but the name does not echo '';// this is a signal to zvertest to expect recaptcha. We use it because not all our contact forms use recaptcha if(1==2&&ZDEF_TEST==1)echo 'just set central session token '.$_SESSION['ctf_tkn'].' to '.$token.' and session_id is '.session_id(); /* ====== the following first name field is to TRAP SPAM !!!!! ==============*/ echo '

'; echo '

'; echo '

'; /* echo '

'; echo '

'; echo ''; echo '

'; */ echo '
'; echo '
'; echo ''; echo '
'; echo '

Please note your condolence will be published on this website, but not immediately. All condolences are reviewed before posting. Privacy and Terms

'; echo '
'; } } if(1==2&&ZDEF_TEST==1)echo '

current session id is '.session_id().'.

'; if(isset($response)){ $response['js']='ctf_ini'; header('Content-type: application/json;charset=utf-8'); $response=array('XP'=>$response); echo json_encode($response); die; } ?>