Exemple #1
0
    error_log("Final Score: " . $output1);
    settype($output1, "integer");
    if ($output1 >= 3) {
        error_log("The match is SUCCESS !!!!");
        //Also authorize and Open
        logAndOpen("TestArgTODOReplace");
    } else {
        error_log("The match is FAILED !!!!");
    }
} else {
    error_log("Sorry, the key does not exist");
}
//function to log and open
function logAndOpen($arg)
{
    //Enter into the DB
    $output = shell_exec("sh logEntry.sh {$arg}");
    // Invoke Spark API
    $response = file_get_contents('http://example.com/');
}
// Authorize Open in Database as well as Spark
if (isset($_REQUEST['authorizeOpen'])) {
    $imgData = $_REQUEST['authorizeOpen'];
    $imgData = str_replace(" ", "+", $imgData);
    $data = base64_decode($imgData);
    //    $data = $imgData;
    error_log("1 " . $imgData);
    logAndOpen($imgData);
} else {
    error_log("Sorry, the key does not exist");
}
Exemple #2
0
     if ($username == "*****@*****.**" && $password == "hack") {
         echo "login:success";
     } else {
         echo "login:failure";
     }
 } else {
     if (isset($_REQUEST['authorizePerm'])) {
         // Authorize Open in Database as well as Spark
         error_log("Owner Approved the request");
         $name = $_REQUEST['authorizePerm'];
         logAndOpen(1, "{$name}");
     } else {
         if (isset($_REQUEST['authorizeOnce'])) {
             // Authorize Open in Database as well as Spark
             error_log("Owner Approved the request");
             logAndOpen(0, "StrangerA");
         } else {
             if (isset($_REQUEST['rejectAccess'])) {
                 // Reject the access
                 error_log("Rejected Access");
                 $fileName = "StrangerR" . '_' . time();
                 //Enter into the DB
                 $output = shell_exec("sh logEntry.sh {$fileName}");
                 shell_exec('cp stranger/image.png stranger/Rejected/' . $fileName . '.png');
                 shell_exec('mv stranger/image.png stranger/image_rejected.png');
             } else {
                 if (isset($_REQUEST['pollAuthRequest'])) {
                     // Poll for Stranger
                     error_log("Polling...");
                     if (file_exists('stranger/image_approved.png')) {
                         error_log("Approved");