JezK
Edit File: compose_msg.php
<?php error_reporting(0); include_once 'databaseConn.php'; include ('header_2.php'); include_once './lib/requestHandler.php'; $DatabaseCo = new DatabaseConn(); //print_r($_SESSION); //include_once 'auth.php'; include_once './class/Config.class.php'; $configObj = new Config(); include_once './class/XssClean.php'; $xssClean = new xssClean(); $matid=isset($_SESSION['user_id'])?$_SESSION['user_id']:''; $sel=$DatabaseCo->dbLink->query("SELECT * FROM payments where current_plan='Yes' and pmatri_id='$matid'"); $fet=mysqli_fetch_array($sel); $tot_contacts=$fet['p_msg']; $use_contacts=$fet['r_sms']; $use_contacts=$use_contacts+1; $exp_date=$fet['exp_date']; $today= date('Y-m-d'); if($tot_contacts>=$use_contacts && $exp_date > $today) { } else { ?> <script>//alert('Your membership is expired or you are not a paid member, please upgrade your membership now.');</script> <?php //echo "<script>window.location='premium_member.php'</script>"; } if(isset($_GET['user_id'])) { //"select matri_id,username,email from register where status!='Suspended' and status!='Inactive' and matri_id='".$_GET['user_id']."'") $get_arr_username_email=$DatabaseCo->dbLink->query("select matri_id,username,email from register where matri_id='".$_GET['user_id']."'"); } else { //"select matri_id,username,email from register where status!='Suspended' and status!='Inactive' and matri_id!='".$_SESSION['user_id']."' and gender!='".$_SESSION['gender123']."'" $get_arr_username_email=$DatabaseCo->dbLink->query("select matri_id,username,email from register where matri_id!='".$_SESSION['user_id']."' and gender!='".$_SESSION['gender123']."'"); } if($_GET['msg_id']>=0) { $getReplyEmail=mysqli_fetch_object($DatabaseCo->dbLink->query("select * from message where msg_id=".$_GET['msg_id'])); } //print_r($getReplyEmail); if(isset($_POST['to_email'])) { //echo "<pre>"; //print_r($_POST);exit; foreach($_POST['to_email'] as $key=>$val) { $from_id=$_SESSION['user_id']; $get_to_id=mysqli_fetch_object($DatabaseCo->dbLink->query("select matri_id from register where email='".$val."'")); $to_id=$get_to_id->matri_id; $sel=$DatabaseCo->dbLink->query("select * from block_profile where block_by='$to_id' and block_to='$from_id'"); $num=mysqli_num_rows($sel); if(isset($num) && $num > 0) { echo "<script>alert('".$to_id." has blocked you. You can\'t send him messages anymore...');</script>"; } else { $from_email=$_SESSION['email']; $to_email=$val; $subject= htmlspecialchars($xssClean->clean_input($_POST['subject']),ENT_QUOTES); $msg_content= htmlspecialchars($xssClean->clean_input($_POST['msg_content']),ENT_QUOTES); $status =$_POST['msg_status']; $msg_date = date('Y-m-d H:i:s'); $DatabaseCo->dbLink->query("insert into message(msg_id,msg_to,msg_from,msg_subject,msg_content,msg_status,msg_important_status,msg_date) values(NULL,'$to_email','$from_email','".$subject."','".$msg_content."','$status','No','$msg_date')"); $sel=$DatabaseCo->dbLink->query("SELECT * FROM payments where current_plan='Yes' and pmatri_id='$matid'"); $fet=mysqli_fetch_array($sel); $tot_sms=$fet['p_msg']; $use_sms=$fet['r_sms']; $use_sms=$use_sms+1; if($tot_sms>=$use_sms) { $update="UPDATE payments SET r_sms='$use_sms' WHERE current_plan='Yes' and pmatri_id='$matid' "; $d=$DatabaseCo->dbLink->query($update); } $result3 = $DatabaseCo->dbLink->query("SELECT * FROM register,site_config where matri_id = '$to_id'"); $rowcc = mysqli_fetch_array($result3); $name = $rowcc['firstname']." ".$rowcc['lastname']; $matriid = $rowcc['matri_id']; $cpass = $rowcc['cpassword']; $website = $rowcc['web_name']; $webfriendlyname = $rowcc['web_frienly_name']; $from = $rowcc['from_email']; $to = $rowcc['email']; $name = $rowcc['username']; $mno = $rowcc['mobile']; $email_template="<html> <body> <table style='margin:auto;border:5px solid #43609c;min-height:auto;font-family:Arial,Helvetica,sans-serif;font-size:12px;padding:0' border='0' cellpadding='0' cellspacing='0' width='710px'> <tbody> <tr> <td style='float:left;min-height:auto;border-bottom:5px solid #43609c'> <table style='margin:0;padding:0' border='0' cellpadding='0' cellspacing='0' width='710px'> <tbody> <tr style='background:#f9f9f9'> <td style='float:right;font-size:13px;padding:10px 15px 0 0;color:#494949'> <span tabindex='0' class='aBn' data-term='goog_849968294'> <td style='float:left;margin-top:5px;color:#048c2e;font-size:26px;padding-left:15px'>$website</td> </tr> </tbody></table> </td> </tr> <tr> <td style='float:left;width:710px;min-height:auto'> <h6 style='float:left;clear:both;width:680px;font-size:13px;margin:10px 0 0 15px'>Hello,$name</h6> <p style='float:left;clear:both;width:680px;font-size:13px;margin:10px 0 0 15px;color:#494949'> You have received new message in $webfriendlyname site profile, Below is your details. </p> <p style='float:left;clear:both;width:680px;font-size:13px;margin:10px 0 0 15px;color:#494949'> <b style='float:left;margin:5px 0 5px 30px;padding:5px 20px;background:#f3f3f3;font-size:13px;color:#096b53'> Dear, $name <br/> Matri-id : $matriid <br/> </b></p> <p style='float:left;clear:both;width:680px;font-size:13px;margin:10px 0 0 15px;color:#494949'>Thank you for helping us reach you better,</p><p style='float:left;clear:both;width:680px;font-size:13px;margin:10px 0 5px 15px;color:#494949'>Thanks & Regards ,<br>Team $webfriendlyname</p> </td> </tr> </tbody></table> </body> </html> "; $select_frm_email=$DatabaseCo->dbLink->query("select from_email from site_config where id='1'"); $email_data=mysqli_fetch_array($select_frm_email); $frm_email=$email_data['from_email']; // Getting SMS API, if yes proceed furthur // } } /*echo "<script>alert('Your message hase been sent Successfully.');</script>";*/ if($status=='sent') { echo "<script>alert('Your message has been sent Successfully.');</script>"; echo "<script>window.location='sent_msg';</script>"; } else if($status=='draft') { echo "<script>alert('Your message has been saved in draft Successfully.');</script>"; echo "<script>window.location='draft_msg';</script>"; } else if($status=='trash') { echo "<script>alert('Your message has been trashed Successfully.');</script>"; echo "<script>window.location='trash_msg';</script>"; } } ?> <style> .liimg img { width:450px; } </style> <style> .addBlk1 { display:none; } .addBlk2 { display:none; } .addBlk3 { display:none; } </style> <div class="page-wrap ne-aft-log"> <div class="container-fluid"> <div class="row"> <div class="container ne-aft-log ne-aft-log-tp"> <div class="row backBtMailBox"> <div class="col-sm-6" style="color:#fff"> <ol class="breadcrumb cstm_breadcrumb"> <li class="breadcrumb-item"><a href="index.php">Home</a></li> <li class="breadcrumb-item"><a href="profile">Profile</a></li> <li class="breadcrumb-item active">Compose Mail</li> </ol> </div> <div class="col-sm-6"> <a href="javascript:void(0)" onclick="goBack()"> <div class="backBt"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span>Back</span> </div> </a> </div> </div> <div class="xxl-16 xl-16 l-16 m-16 s-16 xs-16 padding-lr-zero-320 padding-lr-zero-480 padding-lr-zero-768 padding-lr-zero"> <?php include ('page-parts/msg-left-menu.php');?> <div class="xxl-12 xl-12 l-12 xs-16 m-16 s-16 ne_inbox_right_pan padding-lr-zero-320 margin-top-10px-320px padding-lr-zero-480 margin-top-10px-480px ne-mrg-top-10-768"> <form id="mes_content_form" method="post" action=""> <div class="xxl-16 xl-16 l-16 m-16 s-16 xs-16 ne-bdr-tpstrip-inbox ne_pad_tp_5px ne_pad_btm_5px" id="upload_form"> <a class="center-text button-orange-border" data-toggle="tooltip" data-placement="left" title="Send Message" id="send_msg"> <i class="fa fa-paper-plane"></i> Send Message </a> <a class="ne_msg_tp_strip" data-toggle="tooltip" data-placement="left" title="Draft" id="draft_msg"> <i class="fa fa-download"></i> </a> <a class="ne_msg_tp_strip" data-toggle="tooltip" data-placement="left" title="Trash" id="trash_msg"> <i class="fa fa-trash"></i> </a> </div> <div class="xxl-16 xl-16 l-16 m-16 s-16 xs-16 ne_pad_tp_5px ne_pad_btm_5px padding-lr-zero"> <label class="xxl-2 xl-2 l-3 m-3 s-3 xs-3 compose_msg_addon" > To : </label> <div class="xxl-14 xl-14 l-13 m-13 s-13 xs-13 padding-lr-zero"> <?php $sendMail=''; $subjectNew=''; if($getReplyEmail->msg_to==$_SESSION['email']) { $sendMail=$getReplyEmail->msg_from; $subjectNew=$getReplyEmail->msg_subject; } else { $sendMail=$getReplyEmail->msg_to; $subjectNew=$getReplyEmail->msg_subject; } $getReplyEmail->msg_to;?> <input type="text" placeholder="Enter Partner Email" class="subjectBox other2" name="to_email[]" id="to_email" style="color:#fff!important" onchange="return checkmail(this.value)" data-validetta="required,email" value="<?php if($_GET['frwd']=='')echo $sendMail;?>"> <!-- <select data-placeholder="Choose Partner Email" class="chosen-select form-control" multiple tabindex="4" name="to_email[]" data-validetta="requiredmail" id="to_email"> <option value=""></option> <?php //while($DatabaseCo->dbRow = mysqli_fetch_object($get_arr_username_email)){?> <option value="<?php //echo $DatabaseCo->dbRow->email;?>"><?php //echo $DatabaseCo->dbRow->matri_id;?></option> <?php //}?> </select> --> </div> </div> <div class="xxl-16 xl-16 l-16 m-16 s-16 xs-16 ne_pad_tp_5px ne_pad_btm_5px padding-lr-zero"> <label class="xxl-2 xl-2 l-3 m-3 s-5 xs-5 compose_msg_addon"> Subject : </label> <div class="xxl-14 xl-14 l-13 m-13 s-11 xs-11 padding-lr-zero"> <input type="text" class="subjectBox other2" placeholder="Enter Your Subject" name="subject" data-validetta="required" style="color:#fff!important" value="<?php if($_GET['frwd']=='')echo $subjectNew;?>"> </div> </div> <ul class="xxl-16 xl-16 s-16 l-16 m-16 xs-16 ne_inbox_msg_section padding-lr-zero "> <li class="xxl-16 xl-16 s-16 l-16 m-16 xs-16 padding-lr-zero ne_pad_tp_15px liimg" style="padding-top:0px;"> <!-- <div class="xxl-16 xl-16 s-16 l-16 m-16 xs-16 ne_pad_btm_15px"> <span style="color:#fff;">Enter Your Message :</span> </div> --> <div class="xxl-16 xl-16 s-16 l-16 m-16 xs-16 padding-lr-zero ne-editor"> <div id="txtEditor"></div> </div> </li> </ul> <div style="display:none"> <textarea id="msg_content" name="msg_content" <?php if($_GET['frwd']==''){?>data-validetta="required" <?php }?> ><?php echo htmlspecialchars_decode($getReplyEmail->msg_content);?></textarea> </div> <input type="hidden" id="msg_staus" name="msg_status" value=""> </form> </div> </div> </div> </div> </div> </div> <!-------------------------------------- jQuery Letest --------------------------------> <script src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript"> //var $_1_11_1 = jQuery.noConflict(); </script> <!-------------------------------------- jQuery Letest End ----------------------------> <!-------------------------------------- Bootstrap js ---------------------------------> <script src="js/bootstrap.min.js"></script> <!-------------------------------------- Bootstrap js End -----------------------------> <!-------------------------------------- jQuery Validation -----------------------------------> <script type="text/javascript" src="js/validetta.js"></script> <!-------------------------------------- jQuery Validation End----------------------------------> <!--------------------------------------Pace js ---------------------------------------> <script src="js/pace.min.js"></script> <!--------------------------------------Pace js End -----------------------------------> <!--------------------------------------choosen-----------------------------------> <script src="js/chosen.jquery.js" type="text/javascript"></script> <script type="text/javascript"> var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {allow_single_deselect:true}, '.chosen-select-no-single' : {disable_search_threshold:10}, '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, '.chosen-select-width' : {width:"100%"} } for (var selector in config) { $(selector).chosen(config[selector]); } <?php if(isset($_GET['user_id']) && !isset($_GET['frwd'])){?> $.ajax({ url: 'to_msg_compose', type: 'POST', data: 'msg_status=sent_msg&user_id=<?php echo $_GET['user_id']; ?>', success: function(data) { $('#to_email').find('option').remove().end().append(data); $('#to_email').trigger("chosen:updated"); var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {allow_single_deselect:true}, '.chosen-select-no-single' : {disable_search_threshold:10}, '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, '.chosen-select-width' : {width:"95%"} } for (var selector in config) { $(selector).chosen(config[selector]); } }, error: function() { //called when there is an error //console.log(e.message); } }); <?php }?> <?php if(isset($_GET['msg_id']) && !isset($_GET['frwd'])){?> $.ajax({ url: 'to_msg_compose', type: 'POST', data: 'msg_status=replay_msg&msg_id='+<?php echo $_GET['msg_id']; ?>, success: function(data) { $('#to_email').find('option').remove().end().append(data); $('#to_email').trigger("chosen:updated"); var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {allow_single_deselect:true}, '.chosen-select-no-single' : {disable_search_threshold:10}, '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, '.chosen-select-width' : {width:"95%"} } for (var selector in config) { $(selector).chosen(config[selector]); } }, error: function() { //called when there is an error //console.log(e.message); } }); <?php } if(isset($_GET['msg_id']) && isset($_GET['frwd'])){ ?> $.ajax({ url: 'to_msg_compose', type: 'POST', data: 'msg_status=forward_msg&msg_id='+<?php echo $_GET['msg_id']; ?>, success: function(data) { $("div.Editor-editor").html(data); }, error: function() { //called when there is an error //console.log(e.message); } });sdfasdfaddsf <?php } if(isset($_GET['msg_id']) && isset($_GET['inb'])){ ?> $.ajax({ url: 'to_msg_compose', type: 'POST', data: 'msg_status=replay_msg_inbox&msg_id='+<?php echo $_GET['msg_id']; ?>, success: function(data) { $('#to_email').find('option').remove().end().append(data); $('#to_email').trigger("chosen:updated"); var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {allow_single_deselect:true}, '.chosen-select-no-single' : {disable_search_threshold:10}, '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, '.chosen-select-width' : {width:"95%"} } for (var selector in config) { $(selector).chosen(config[selector]); } }, error: function() { //called when there is an error //console.log(e.message); } }); <?php }?> </script> <!--------------------------------------choosen End -----------------------------> <script> $('[data-toggle="tooltip"]').tooltip({ trigger: 'hover', 'placement': 'top' }); </script> <script src="js/editor.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#txtEditor").Editor({ 'print':false, 'source':false, 'togglescreen':false, 'splchars':false, 'select_all':false, 'rm_format':false, 'insert_link':false, 'unlink':false, }); //var cmscontent=$("#cms_content").val(); // $("div.Editor-editor").append(cmscontent); $("div.Editor-editor").blur(function(){ var cms_cont= $("div.Editor-editor").html(); $("#msg_content").val(cms_cont); }); $('#send_msg').click(function(){ $('#msg_staus').val('sent'); $('#mes_content_form').submit(); }); $('#draft_msg').click(function(){ $('#msg_staus').val('draft'); $('#mes_content_form').submit(); }); $('#trash_msg').click(function(){ $('#msg_staus').val('trash'); $('#mes_content_form').submit(); }); }); </script> <!---------------Jquery Form validation------------------> <script type="text/javascript"> $(function(){ $('#mes_content_form').validetta({ errorClose : false, custom : { regname : { pattern : /^[\+][0-9]+?$|^[0-9]+?$/, errorMessage : 'Custom Reg Error Message !' }, // you can add more example : { pattern : /^[\+][0-9]+?$|^[0-9]+?$/, errorMessage : 'Lan mal !' } }, realTime : true }); }); </script> <script> function goBack() { window.history.go(-1); } </script> <script> $(document).ready(function(){ //$('.Editor-editor').attr("placeholder", "Enter Your Message!"); $( ".Editor-editor:empty" ).text( "Enter Your Message!" ); window.setInterval(function(){ $( ".Editor-editor:empty" ).text( "Enter Your Message!" ) }, 3000); $(".Editor-editor").click(function(){ if($( ".Editor-editor" ).html() =="Enter Your Message!" ){ $( ".Editor-editor" ).html(''); } }); $(".Editor-editor").blur(function(){ if($( ".Editor-editor" ).html() =="Enter Your Message!" ){ $( ".Editor-editor" ).html(''); } }); $(".Editor-editor").keypress(function(){ if($( ".Editor-editor" ).html() =="Enter Your Message!" ){ $( ".Editor-editor" ).html(''); } }); }); function checkmail(e) { var em=e; var usrd='<?php echo $_SESSION['gender123'];?>'; $.post("ajaxcheck.php",{em:em,usrd:usrd,mode:"CheckEmailExistsOrNot"},function(data){ if(data==0) { alert('This email-id not exists'); $('#to_email').val(''); $('#to_email').focus(); } }); } </script> <!---------------Jquery Form validation End------------------> <?php include_once('page-parts/compose_msg_chk.php');?>