示例#1
0
 if (!class_exists('DataLayer')) {
     die("ERROR: Unable to load DataLayer class.\n");
 }
 $dl = new DataLayer($config['datalayer']);
 if ($dl === false) {
     die("ERROR: Unable to connect to database.\n");
 }
 // Server already exists, update it
 if ($dl->Server_Exists_ByIPAddressPort($values) !== false) {
     if ($dl->Server_Update_ByIPAddressPort($values)) {
         echo "NOTICE: Server record updated successfully!\n";
     } else {
         echo "ERROR: There was an error updating the server record.\n";
     }
 } else {
     if ($dl->Server_Insert($values)) {
         echo "NOTICE: Server record added successfully!\n";
     } else {
         echo "ERROR: There was an error adding the server record.\n";
     }
 }
 //////////////////////////////////
 // Check tokens in ADD too
 //////////////////////////////////
 if (isset($input['checktokens'])) {
     $values = array();
     // We can check multiple tokens at once. Each callsign/ip/token is seperated
     // by a CR/LF (%0D%0A)
     $values['checktokens'] = explode("\r\n", $input['checktokens']);
     // Initialize groups to any empty array
     $values['groups'] = array();