Example #1
0
 }
 // Print the fields in the jSon message
 if ($debug >= 3) {
     $msg = "";
     foreach ($data as $key => $value) {
         $msg .= " " . $key . "->" . $value . ", ";
     }
     $log->lwrite("main:: Rcv json msg: <" . $msg . ">");
 }
 // Check if this is a trusted Internal IP connection. Every address inside our home network
 // is trusted. Trustlevel needs to be larger than 0 to pass.
 // If we receive a message and our trustlevel is too low, we will not continue until
 // the user first "repairs" that trust. As a result, the last command from the client
 // will probably be lost, as all communication is async ...
 //
 if ($sock->s_trusted() <= 0) {
     // Here is for when we do not trust the client
     // It could be however that the client just sent his login data, therefore
     // we check for these first
     //
     $log->lwrite("main:: external client " . $sock->clientIP . " not trusted", 3);
     // If user has aleady set local storage/cookie for this IP for the password,
     // he/she will be done quickly
     //
     if ($data['action'] == "login") {
         $log->lwrite("main:: received login request from ip " . $sock->clientIP . ", action: " . $data['action'] . ", login: "******", password: "******"1";
             $sock->sockadmin[$ckey]['login'] = $data['login'];