added Key Grabber
This commit is contained in:
parent
dad99e12c5
commit
070ca57c96
1 changed files with 54 additions and 0 deletions
54
keyGrab.php
Normal file
54
keyGrab.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Loading…
Add table
Reference in a new issue