| 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 : /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 have you added as friends
$query2 = "select email from penpalspotlight where domain ='$domain' and email != '$email' and status ='1' and datecreated >= NOW() - INTERVAL 1 WEEK order by datecreated desc";
//echo $query2;
//exit;
$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(!$result2= mysqli_query($con,$query2))
{
mysqli_close($con);
return "#";
}
else
{
$items= [];
while($row2 = mysqli_fetch_array($result2))
{
// echo $row2[0];
//innner query using top query as inputs
$query= "select name,country,email,gender,phonenumber,location,profileMessage,birthDate,photo_url1,userType,lastSeen,usertoken,
photoUpload,userStatus,wallet_backup,gift_out from penpal where email ='$row2[0]' and domain='$domain' and deleteaccount='0'";
// echo $query;
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while($row = mysqli_fetch_array($result))
{
//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],
'userType' => $row[9],
'lastSeen' => $row[10],
'usertoken' =>$row[11],
'photoUpload' =>$row[12],
'userStatus' =>$row[13],
'user_email' =>$email,
'domain' => $domain,
'domain' => $domain,
'wallet_backup' =>$row[14],
'gift_out' => $row[15],
'fans' => $fans,
'following' => $following
];
} //inner loop ends here
}
}//END OF WHILE
echo json_encode($items);
}
}//getUserJSON
//********************** Function ends
//$response = array();
$email=$_POST["email"];
$domain =$_POST["domain"];
//$email = "nosa.osahon@penpalamerica.com";
//$domain = "penpalamerica.com";
getUserJSON ($email,$domain);