Exemple #1
0
     @fclose($socket);
 }
 // Now that we have the IP address, see if this server is already in our
 // database.  If so, just update, otherwise, insert a new record
 // Load the DataLayer
 @(include_once 'includes/datalayer.class.php');
 // Make sure the DataLayer class loaded sucessfully
 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
 //////////////////////////////////