diff --git a/keyGrab.php b/keyGrab.php new file mode 100644 index 0000000..d071fd9 --- /dev/null +++ b/keyGrab.php @@ -0,0 +1,54 @@ +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(); +} + + + ?>