This commit is contained in:
nolanwhy 2023-02-16 10:53:24 +01:00
parent a98ae57cea
commit a84e48f406
2 changed files with 34 additions and 0 deletions

View File

@ -1,6 +1,7 @@
<?php
require 'core/config.php';
require 'core/classes/user.php';
require 'core/classes/friendships.php';
require 'core/classes/RCCServiceSoap.php';
$RCCServiceSoap = new RCCServiceSoap($soapcfg["ip"],$soapcfg["port"],$soapcfg["url"]);

View File

@ -0,0 +1,33 @@
<?php
class friendships{
// made by nolanwhy - remove if ugly
private $con;
public function __construct($con, $id) {
$this->con = $con;
}
public function isFriends($user1, $user2) {
$sql = "SELECT * FROM friendships WHERE user1 = :user1 AND user2 = :user2 AND isAccepted = 1";
$q = $this->con->prepare($sql);
$q->bindParam(':user1',$user1,PDO::PARAM_INT);
$q->bindParam(':user2',$user2,PDO::PARAM_INT);
$q->execute();
$friendship = $q->fetch();
if(!$friendship) {
$q = $this->con->prepare($sql);
$q->bindParam(':user1',$user2,PDO::PARAM_INT);
$q->bindParam(':user2',$user1,PDO::PARAM_INT);
$q->execute();
$friendship = $q->fetch();
if(!$friendship) {
return false;
} else {
return true;
}
} else {
return true;
}
}
}