| 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/penpalamerica.com/wwwroot/penpal/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Origin : *');
header('Access-Control-Allow-Methods : POST, GET, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers : *');
exit;
}
//****************** Function starts
function getUserJSON( $email,$domain)
{
// $query= "select b.name,latest_message,message_count from penpalfriends as a, penpal as b where //
//(email_u='$email' or email_f='$email') and (b.email ='$email') and b.domain='penpalamerica.com' and a.domain='penpalamerica.com'";
// first query those you add as friends
$query= "select name,country,email,gender,phonenumber,location,profileMessage,birthDate,photo_url1,photo_url2,photo_url3,photo_url4,photo_url5,photo_url6,userType,lastSeen,usertoken,photoUpload,userStatus,latest_message,message_count_u,message_count_f,email_f, wallet_backup,gift_out from penpalfriends as a, penpal as b where (email_u='$email' and (b.email =email_f) and b.domain='$domain' and a.domain='$domain' and a.deleteaccount='0' and a.unmatch='0' and photoupload ='true') or (email_f='$email' and (b.email =email_u) and b.domain='$domain' and a.domain='$domain' and b.deleteaccount='0' and a.unmatch='0' and photoupload ='true')
order by a.datecreated desc ";
//echo $query;
//die();
//sql> select b.name,latest_message,message_count from penpalfriends as a, penpal as b where email_u='victor@date.com' and (b.email =email_f ) and b.domain='penpalamerica.com' and a.domain='penpalamerica.com';
$cnt ="#";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
// //echo mysqli_error($con);
//echo "-1";
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
$message_count=0;
$items= [];
while($row = mysqli_fetch_array($result))
{
$photo_number=0;
if($row[8] !=""){
$photo_number++;
}
if($row[9] !=""){
$photo_number++;
}
if($row[10] !=""){
$photo_number++;
}
if($row[11] !=""){
$photo_number++;
}
if($row[12] !=""){
$photo_number++;
}
if($row[13] !=""){
$photo_number++;
}
$message_count= $row[21];
if($row[22] !=$email ){
$message_count= $row[20];
}
//computer fans:
$query= "select count(*) as response from penpalfriends as a, penpal as b where (email_u='$row[2]' and (b.email =email_f) and b.domain='$domain' and a.domain='$domain' and a.deleteaccount='0' and a.unmatch='0' and photoupload ='true') or (email_f='$row[2]' and (b.email =email_u) and b.domain='$domain' and a.domain='$domain' and b.deleteaccount='0' and a.unmatch='0' and photoupload ='true')";
$response1 = getQuery1($query);
$fans =$response1;
$query= "select count(*) as tot from penpalfollowers where email_f='$row[2]' and deleteaccount ='0'";
$response1 = getQuery1($query);
$fans= $fans+$response1;
//computer following
$query= "select count(*) as tot from penpalfollowers where email_u='$row[2]' and deleteaccount ='0'";
$response1 = getQuery1($query);
$following =$response1;
$items[] = [
'name' => $row[0],
'country' => $row[1],
'email' => $row[2],
'gender' => $row[3],
'phonenumber' => $row[4],
'location' => $row[5],
'profileMessage' => $row[6],
'birthDate' => $row[7],
'photo_url1' => $row[8],
'photo_url2' => $row[9],
'photo_url3' => $row[10],
'photo_url4' => $row[11],
'photo_url5' => $row[12],
'photo_url6' => $row[13],
'photo_number' => $photo_number,
'userType' => $row[14],
'lastSeen' => $row[15],
'usertoken' =>$row[16],
'photoUpload' =>$row[17],
'userStatus' =>$row[18],
'latest_message' => str_replace("^","'",$row[19]),
'message_count' => $message_count,
'user_email' =>$email,
'domain' => $domain,
'wallet_backup' =>$row[23],
'gift_out' => $row[24],
'fans' => $fans,
'following' => $following
];
}
echo json_encode($items);
mysqli_close($con);
return $cnt;
}
}//getUserJSON
//********************** Function ends
//$response = array();
$email=$_POST["email"];
$domain =$_POST["domain"];
getUserJSON ($email,$domain);
?>