54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
include('../Auth/index.php');
|
|
include('../Auth/db.ini.php');
|
|
|
|
function grabPublicKey($uid){
|
|
global $dbservername;
|
|
global $dbusername;
|
|
global $dbpassword;
|
|
global $dbname;
|
|
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
$sql = "SELECT publicKey FROM smz_messages_users WHERE uid='$uid'";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
return $row["publicKey"];
|
|
}
|
|
} else {
|
|
// ungültige Session
|
|
return false;
|
|
}
|
|
$conn->close();
|
|
}
|
|
function grabPrivateKey(){
|
|
global $dbservername;
|
|
global $dbusername;
|
|
global $dbpassword;
|
|
global $dbname;
|
|
global $uid;
|
|
// global $password_hash;
|
|
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
$sql = "SELECT privateKey FROM smz_messages_users WHERE uid='$uid'";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
return $row["privateKey"];
|
|
}
|
|
} else {
|
|
// ungültige Session
|
|
return false;
|
|
}
|
|
$conn->close();
|
|
}
|
|
|
|
|
|
?>
|