ALSATKİRALIK - HEPSİNI ARA - ARIYORUZ
No 92 Utku Apt. kat 1
Konyaaltı / Arapsuyu
07070, Antalya
lineerkostik2022@gmail.com
$message=json_decode($_POST["message"]);
$message_id=xdenc($message->message_id);
$product_id=xdenc($message->product_id);
$project_id=xdenc($message->project_id);
$message_type_id=$message->message_type_id;
$message_location="";
if(@$message->location){
$message_location=$message->location;
}
$toemail="";
if(@$message->toemail){
$toemail=$message->toemail;
}
$message_title=enc_str($message->message_title);
$message_title=str_replace("'", "", $message_title);
$message_title=str_replace("`", "", $message_title);
$message_title=str_replace("\\", "", $message_title);
$message_title_clean=str_replace("
", " ", $message_title);
$message_title_clean=str_replace("
", "", $message_title_clean);
$message_title_clean=str_replace("", "", $message_title_clean);
$message_photo=$message->photo;
$message_dialog_title=$message->dialog_title;
$product_link=$message->product_link;
$message_createdate=date("d m , Y, H:i");
if ($message_location!="") {
$message_body=enc_str($message->message_body."
".lbl("location").":".$message_location);
} else {
$message_body=enc_str($message->message_body);
}
$from_member_id=xdenc($message->from_member_id);
$from_name=enc_str($message->from_name);
$from_email=$message->from_email;
$from_email=$message->from_email;
$pos1=stripos($from_email, "serelladavid");
$pos2=stripos($from_email, "qq.com");
$pos3=stripos($from_email, "adamspatrick");
$pos4=stripos($from_email, "dahab");
$pos5=stripos($from_email, "adisadahab");
if ($pos1 !== false || $pos2 !== false || $pos3 !== false || $pos4 !== false || $pos5 !== false) {
$send_status=new stdClass();
$send_status->result = 0;
$send_status->error="";
echo json_encode($send_status);
return;
}
$from_phone=enc_str($message->from_phone);
if ($message->want_to_buy) {$want_to_buy=enc_str($message->want_to_buy);} else {$want_to_buy=null;}
if ($message->want_to_sell) {$want_to_sell=enc_str($message->want_to_sell);} else {$want_to_sell=null;}
if ($message->want_to_rent) {$want_to_rent=enc_str($message->want_to_rent);} else {$want_to_rent=null;}
if ($message->want_to_give_rent) {$want_to_give_rent=enc_str($message->want_to_give_rent);} else {$want_to_give_rent=null;}
$to_member_id=xdenc($message->to_member_id);
$to_firm_id=xdenc($message->to_firm_id);
if ($to_member_id>0) {
$sql="select m.id as to_member_id, concat(m.name, ' ', m.surname) as full_name, email from member m where id=$to_member_id";
} else {
$to_member_id=0;
$sql="select m.id as to_member_id, concat(m.name, ' ', m.surname) as full_name, m.email from member m inner join firmfast f on f.id=m.fk_firm where m.fk_role=1 and f.id=$to_firm_id";
}
$members=get_rows($sql);
if(count($members)>0 && $to_member_id==0){
$member=$members[0];
$to_member_id=$member["to_member_id"];
}
$sql="insert into message";
$sql.=" set fk_message=$message_id, fk_product=$product_id, fk_project=$project_id, fk_messagetype=$message_type_id, title='$message_title', body='$message_body',";
$sql.=" from_fk_member=$from_member_id, from_name='$from_name', from_email='$from_email', from_phone='$from_phone',photo='$message_photo',";
if ($want_to_buy!="" && $want_to_buy!=null) {$sql.="want_to_buy='$want_to_buy',";}
if ($want_to_sell!="" && $want_to_sell!=null) {$sql.="want_to_sell='$want_to_sell',";}
if ($want_to_rent!="" && $want_to_rent!=null) {$sql.="want_to_rent='$want_to_rent',";}
if ($want_to_give_rent!="" && $want_to_give_rent!=null) {$sql.="want_to_give_rent='$want_to_give_rent',";}
$sql.=" to_fk_member=$to_member_id, to_fk_firm=$to_firm_id";
$result=insert($sql);
echo xenc($result);
$want="";
if ($want_to_buy!="" && $want_to_buy!=null) {$want.=$want_to_buy."
,";}
if ($want_to_sell!="" && $want_to_sell!=null) {$want.=$want_to_sell."
,";}
if ($want_to_rent!="" && $want_to_rent!=null) {$want.=$want_to_rent."
,";}
if ($want_to_give_rent!="" && $want_to_give_rent!=null) {$want.=$want_to_give_rent."
,";}
$message_body=$want.$message_body;
if(count($members)>0){
$member=$members[0];
$msg=new stdClass();
$msg->to=new stdClass();
if ($toemail!="") {
$msg->to->name=$toemail;
$msg->to->email=$toemail;
} else {
$msg->to->name=$member["full_name"];
$msg->to->email=$member["email"];
}
$msg->subject="EMLAK KUTUSU "." ".lbl("new_message")." ".$from_name."/ ".$message_dialog_title." ".$message_title_clean;
$html="";
$html.="
".$message_dialog_title." ".$message_title_clean."";
$html.="";
$html.="
";
if ($product_id>0 || $project_id>0) {
$html.="";
$html.="";
$html.="";
$html.="";
$html.=" | ";
$html.=" | ";
$html.=" | ";
$html.="".$message_title." | ";
$html.=" ";
$html.=" ";
$html.=" | ";
$html.="
";
}
$html.="";
$html.="";
$html.="";
$html.="";
$html.="".$message_dialog_title." | ";
$html.=" ";
$html.="";
$html.="".$message_body." | ";
$html.=" ";
$html.=" ";
$html.=" | ";
$html.="";
$html.="";
$html.="";
$html.="".$message_createdate." | ";
$html.=" ";
$html.="";
$html.="".$from_name."
".$from_email." " .$from_phone." | ";
$html.=" ";
$html.=" ";
$html.=" | ";
$html.="
";
$html.="
";
$html.="";
$html.="";
$msg->body=$html;
$result=send_email_raw_emlakkutusu($msg);
}