updating communication
This commit is contained in:
@@ -12,7 +12,7 @@ function check_apikey(){
|
||||
else{
|
||||
$apikey=$_GET["apikey"];
|
||||
$machineid=$_GET["machineid"];
|
||||
$sql = "SELECT * FROM api WHERE apikey = ? and machineid = ?";
|
||||
$sql = "SELECT * FROM api WHERE apikey = ? and machine_id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("ss", $apikey,$machineid);
|
||||
|
||||
@@ -28,6 +28,7 @@ function check_apikey(){
|
||||
//apikey authenticated
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function load_secret(){
|
||||
include "../../../config.php";
|
||||
@@ -37,12 +38,12 @@ function load_secret(){
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
if(!isset($_GET["apikey"]) or !isset($_GET["machineid"])){
|
||||
return false;
|
||||
return "nan";
|
||||
}
|
||||
else{
|
||||
$apikey=$_GET["apikey"];
|
||||
$machineid=$_GET["machineid"];
|
||||
$sql = "SELECT * FROM secrets machineid = ?";
|
||||
$sql = "SELECT * FROM secrets machine_id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("s",$machineid);
|
||||
|
||||
@@ -57,6 +58,6 @@ function load_secret(){
|
||||
return $row["cert"];
|
||||
}
|
||||
}
|
||||
|
||||
return "nan";
|
||||
}
|
||||
?>
|
||||
@@ -107,11 +107,13 @@ include "../../../config.php";
|
||||
$row = $result->fetch_assoc();
|
||||
if($row!==null){
|
||||
$this_server=$row["value"];
|
||||
}else{
|
||||
$this_server="http://localhost";
|
||||
}
|
||||
$stmt -> close();
|
||||
//create the files and download them
|
||||
$fp=fopen("/var/www/html/export/setup.txt","w");
|
||||
fwrite($fp,"$this_server");
|
||||
fwrite($fp,"server $this_server");
|
||||
fclose($fp);
|
||||
$fp=fopen("/var/www/html/export/secrets.txt","w");
|
||||
fwrite($fp,"machineid $machineid\n");
|
||||
|
||||
Reference in New Issue
Block a user