| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/penpaleurope.com/backup/app/Penpal/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
include 'sendmailclient.php';
function checkSpamFilter($messageTocheck)
{
$response = "#";
$strfield = "";
$query = "select spamword from penpalspamfilter";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while($row = mysqli_fetch_array($result))
{
$strfield = $row[0];
if (stripos($strfield, $messageTocheck) !== false)
$response="0" ;
}
mysqli_close($con);
}
return $response;
}//check spam filters
function trackOfflineMessage($mpalid, $mpalidother){
//echo "nosa";
$query = "select status from penpalmessageoffline where palid ='$mpalid' and palidother ='$mpalidother'";
//echo $query;
//die();
$queryresponse = getQuery1($query);
if ($queryresponse != "#"){
$query = "Update penpalmessageoffline set status='1',LastMsgDate=now() where palid ='$mpalid' and palidother ='$mpalidother'";
updateQuery($query);
// echo $query;
}
else{
$query = "insert into penpalmessageoffline (palid,palidother,status,LastMsgDate) values ('$mpalid','$mpalidother','1',now())";
// echo $query;
//die();
updateQuery($query);
}
return "done";
}//penpalsessionsearch
function PenpalsessionSearchAge($msisdn, $method, $firstpage, $endpage, $recordno,$age, $sex){
$query = "select msisdn from penpalsessionsearch where msisdn ='" . $msisdn . "'";
$counter = getQuery1($query);
if ($counter != "#"){
$query = "Update penpalsessionsearch set method='" . $method . "',firstpage='" . $firstpage . "',endpage='" . $endpage . "',recordno='" . $recordno . "',response1='" . $age . "',sex='" . $sex . "' where msisdn ='" . $msisdn . "'";
updateQuery($query);
// echo $query;
}
else{
$query = "insert into penpalsessionsearch (msisdn,method,firstpage,endpage,recordno,response1,sex) values ('" . $msisdn . "','" . $method . "','" . $firstpage . "','" . $endpage . "','" . $recordno . "','" . $age . "','" . $sex . "')";
updateQuery($query);
}
return "done";
}//penpalsessionsearchAge
function messageCounter($mpalid){
$totalmessage=0;
$query = "select counter from penpalmessagecount where palid ='" . $mpalid . "'";
$counter = getQuery1($query);
if ($counter != "#"){
$totalmessage = (int)$counter + 1;
$query = "Update penpalmessagecount set counter=" . $totalmessage . " where palid ='" . $mpalid . "'";
updateQuery($query);
}
else{
//int totalmessage = stoi(counter) + 1;
$query = "insert into penpalmessagecount (palid,counter) values ('" . $mpalid . "',1)";
updateQuery($query);
}
}
function messageLimit($mpalid,$mpalidother){
$totalmessage=0;
$query = "select palidsender from penpalmessagelimit where palidsender ='$mpalid' and PalIDreceiver='$mpalidother'";
$counter = getQuery1($query);
if ($counter != "#"){
$query = "Update penpalmessagelimit set datesent=now() where palidsender ='$mpalid' and PalIDreceiver='$mpalidother'";
updateQuery($query);
}
else{
//int totalmessage = stoi(counter) + 1;
$query = "insert into penpalmessagelimit (Palidsender,Palidreceiver) values ('$mpalid','$mpalidother')";
updateQuery($query);
}
}
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function rand_string2( $length ) {
$chars = "0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
$db = new PDO('mysql:host=127.0.0.1;dbname=smartsmsrouter','smsEngine','guEnaR28T');
$palidsender = $_POST['palidsender'];
$message = $_POST['message'];
$palidreceiver = $_POST['palidreceiver'];
$palsender = $_POST['palsender'];
$palreceiver = $_POST['palreceiver'];
$insert = $db->prepare("INSERT INTO Penpalchatmessages (Palidsender,message,Palidreceiver,palsender,palreceiver) values ('$palidsender','$message','$palidreceiver','$palsender','$palreceiver')") ;
$insert ->execute();
//increase chatmessage counter
messageCounter($palidsender);
messageLimit($palidsender,$palidreceiver);
//echo "<li class ='cm'><b>".ucwords($name)."</b> - ".$message."</li>";
//Get other pal status
$query = "select online from penpalsubscriber where palid ='$palidreceiver'";
$queryresponse = getQuery1($query);
if ($queryresponse =="0"){
//check if pending offmessage
$query = "select status from penpalmessageoffline where palid ='$palidsender' and palidother ='$palidreceiver'";
$queryresponse = getQuery1($query);
if (($queryresponse =="0" ) || ($queryresponse =="#")){
$query = "select age,sex,country from penpalsubscriber where palid ='$palidsender'";
$queryresponse = getQuery3($query);
$profilesub="";
if ($queryresponse != "#"){
$sep= explode(",", $queryresponse);
$age =$sep[0]; // piece1
$sex= $sep[1]; // piece2
$country =$sep[2]; // piece1
$profilesub ="Nickname : $palsender, Age: $age, Sex: $sex, Country: $country ";
}
$mysub =ucwords($palsender)." Sent you a Message";
$palid =$palidsender;
$nickname=$palsender;
$nicknameother=$palreceiver;
$emailID = rand_string(30);
$encryID = rand_string(20);
$query = "insert into penpalemailmessage ( palid,palidother,messageid,encryption,status) values ('$palidsender','$palidreceiver','$emailID','$encryID','0')";
$queryresponse=updateQuery($query);
$myMessage ="<!doctype html> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> <title>Responsive Email Template</title> <style type='text/css'> .ReadMsgBody {width: 100%; background-color: #ffffff;} .ExternalClass {width: 100%; background-color: #ffffff;} body {width: 100%; background-color: #ffffff; margin:0; padding:0; -webkit-font-smoothing: antialiased;font-family: Georgia, Times, serif} table {border-collapse: collapse;} @media only screen and (max-width: 640px) { body[yahoo] .deviceWidth {width:440px!important; padding:0;} body[yahoo] .center {text-align: center!important;} } @media only screen and (max-width: 479px) { body[yahoo] .deviceWidth {width:280px!important; padding:0;} body[yahoo] .center {text-align: center!important;} } </style> </head> <body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' yahoo='fix' style='font-family: Georgia, Times, serif'> <!-- Wrapper --> <table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'> <tr> <td width='100%' valign='top' bgcolor='#ffffff' style='padding-top:20px'> <!-- Start Header--> <table width='580' border='0' cellpadding='0' cellspacing='0' align='center' class='deviceWidth' style='margin:0 auto;'> <tr> <td width='100%' bgcolor='#ffffff'> <!-- Logo --> <table border='0' cellpadding='0' cellspacing='0' align='left' class='deviceWidth'> <tr> <td style='padding:10px 20px' class='center'> <a href='#'><img src='http://www.penpalafrica.com/email/penpalemaillogo.png' alt='PenpalAfrica Logo' border='0' /></a> </td> </tr> </table><!-- End Logo --> <!-- Nav --> <table border='0' cellpadding='0' cellspacing='0' align='right' class='deviceWidth'> <tr> <td class='center' style='font-size: 13px; color: #272727; font-weight: light; text-align: right; font-family: Georgia, Times, serif; line-height: 20px; vertical-align: middle; padding:10px 20px; font-style:italic'> <a href='http://www.penpalafrica.com/index.php' style='text-decoration: none; color: #3b3b3b;'>Home</a> <a href='http://www.penpalafrica.com/login.php' style='text-decoration: none; color: #3b3b3b;'>Login</a> <a href='http://www.penpalafrica.com/faq.html' style='text-decoration: none; color: #3b3b3b;'>FAQ</a> </td> </tr> </table><!-- End Nav --> </td> </tr> </table><!-- End Header --> <!-- 2 Column Images & Text Side by SIde --> <table width='580' border='0' cellpadding='0' cellspacing='0' align='center' class='deviceWidth' bgcolor='#202022' style='margin:0 auto;'> <tr> <td style='padding:10px 0'> <table align='left' width='49%' cellpadding='0' cellspacing='0' border='0' class='deviceWidth'> <tr> <td valign='top' align='center' class='center' style='padding-top:20px'> <a href='#' padding:0 10px 10px 0'><a href='#' style='text-decoration: none; font-size: 10px; color: #ccc; font-weight: bold; font-family:Arial, sans-serif '><img width='200' src='http://penpalafrica.com/penpal/assets/img/subscribers/##palid##/thumbnail/##palid##.jpg' alt='' border='0' style='border-radius: 4px; width: 200px; display: block;' class='deviceWidth' />##profile##</a> </td> </tr> </table> <table align='right' width='49%' cellpadding='0' cellspacing='0' border='0' class='deviceWidth'> <tr> <td style='font-size: 12px; color: #959595; font-weight: normal; text-align: left; font-family: Georgia, Times, serif; line-height: 24px; vertical-align: top; padding:10px 8px 10px 8px'> <table> <tr> <td valign='middle' style='padding:0 10px 10px 0'><a href='#' style='text-decoration: none; font-size: 16px; color: #ccc; font-weight: bold; font-family:Arial, sans-serif '>Message from ##nickname##</a> </td> </tr> </table> <p style='mso-table-lspace:0;mso-table-rspace:0; margin:0'> ##nicknameother##, you have a new message from ##nickname##. Kindly click on the button below to read the message. <br/><br/> <table width='100' align='right'> <tr> <td bgcolor='#409ea8' style='padding:5px 0;background-color:#409ea8; border-top:1px solid #77d5ea; background-repeat:repeat-x' align='center'> <a href='http://www.penpalafrica.com/messageoffline.php?id=##messageid##&en=##encry##' style=' color:#ffffff; font-size:13px; font-weight:bold; text-align:center; text-decoration:none; font-family:Arial, sans-serif; -webkit-text-size-adjust:none;'> Read Message </a> </td> </tr> </table> </p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor='#fe7f00'><div style='height:6px'> </div></td> </tr> </table><!-- End 2 Column Images & Text Side by SIde --> <!-- 4 Columns --> <table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'> <tr> <td bgcolor='#363636' style='padding:30px 0'> <table width='580' border='0' cellpadding='10' cellspacing='0' align='center' class='deviceWidth' style='margin:0 auto;'> <tr> <td> <table width='45%' cellpadding='0' cellspacing='0' border='0' align='left' class='deviceWidth'> <tr> <td valign='top' style='font-size: 11px; color: #f1f1f1; color:#999; font-family: Arial, sans-serif; padding-bottom:20px' class='center'> You are receiving this email because<br/> 1.) You are subscriber of penpalafrica.com or<br/> 2.) You subscribed via <a href='http://www.penpalafrica.com' style='color:#999;text-decoration:underline;'>our website</a><br/> <br/><br/> Want to be removed? No problem, <a href='http://www.penpalafrica.com/unsubscribe.php?id=##messageid##&en=##encry##' style='color:#999;text-decoration:underline;'>click here</a> and we will not send you messages again. </td> </tr> </table> <table width='40%' cellpadding='0' cellspacing='0' border='0' align='right' class='deviceWidth'> <tr> <td valign='top' style='font-size: 11px; color: #f1f1f1; font-weight: normal; font-family: Georgia, Times, serif; line-height: 26px; vertical-align: top; text-align:right' class='center'> <a href=''><img src='http://www.penpalafrica.com/email/footer_rss.gif' width='42' height='42' alt='RSS Feed' title='RSS Feed' border='0' /></a> <a href=''><img src='http://www.penpalafrica.com/email/footer_twitter.gif' width='42' height='42' alt='Twitter' title='Twitter' border='0' /></a> <a href=''><img src='http://www.penpalafrica.com/email/footer_vm.gif' width='42' height='42' alt='Vimeo' title='Vimeo' border='0' /></a> <a href=''><img src='http://www.penpalafrica.com/email/footer_fb.gif' width='42' height='42' alt='Facebook' title='Facebook' border='0' /></a> <br /> <a href='#' style='text-decoration: none; color: #848484; font-weight: normal;'>support@penpalafrica.com</a> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table><!-- End 4 Columns --> </td> </tr> </table> <!-- End Wrapper --> <div style='display:none; white-space:nowrap; font:15px courier; color:#ffffff;'> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div> </body> </html> ";
//replace emailid and encryid in email messages
$myMessage =str_replace("##palid##",$palid,$myMessage);
$myMessage =str_replace("##nickname##",$nickname,$myMessage);
$myMessage =str_replace("##nicknameother##",$nicknameother,$myMessage);
$myMessage =str_replace("##profile##",$profilesub,$myMessage);
$myMessage =str_replace("##messageid##",$emailID,$myMessage);
$myMessage =str_replace("##encry##",$encryID,$myMessage);
$query = "select email from penpalsubscriber where palid ='$palidreceiver'";
$queryresponse = getQuery1($query);
$email = $queryresponse;
$mymail = sendmailtoclient($email,$myMessage,$myMmessage,$mysub,$mfrom,$mfromname,$gate);
//update the penpalmessageoffline;
$response = trackOfflineMessage($palidsender, $palidreceiver);
}
}
?>