Posted By

lasavior on 06/04/11


Tagged


Versions (?)

UpdateDNS.php


 / Published in: PHP
 

This is to compliment my hostname class, and is provided as a demonstration on how to write a simple script to update the database for a traveling IP. See http://snipplr.com/view/54138/hostname-class/ for more information

  1. <?php
  2.  
  3. //******INSERT PASSWORD PROTECTION HERE******
  4. //
  5. //You should not leave this script unprotected
  6. //as anyone who runs this as-is could change
  7. //the IP and gain access
  8.  
  9.  
  10. require_once($_SERVER['DOCUMENT_ROOT'].'/hostname.class.php');
  11. $hostname = new hostname();
  12.  
  13. $newdnsip = isset($_GET['blockip']) ? '255.255.255.255' : $_SERVER['REMOTE_ADDR'];
  14. $hostname->putCache($newdnsip);
  15.  
  16. if ($hostname->lastError == ''):
  17.  
  18. die("good ".$newdnsip);
  19. else:
  20.  
  21. die(print_r($hostname->errorLog));
  22. endif;
  23.  
  24. ?>

Report this snippet  

You need to login to post a comment.