// check to see if this is a url rather than a domain / regexp
 // basic check looking for :// (could be http / https)
 if (preg_match('#://#', $website)) {
     // parse_url adds additional checks against the value - returns false on error
     $url_array = parse_url($website);
     if (isset($url_array['host'])) {
         $site = $url_array['host'];
     } else {
         if ($debug) {
             print "Error trying to add new site invalid url\n";
         }
         $err = Errors::getInstance();
         $err->errorEvent(ERROR_PARAMETER, "Error trying to add new site invalid url");
     }
 } else {
     $site = $parms->validateParm($website, 'website', 'domain');
 }
 // site should now have a domain entry - either extracted from url or from validation. If it does not then it will be '' so error
 if ($site == '') {
     if ($debug) {
         print "Invalid website / domain / expression \n";
     }
     $err = Errors::getInstance();
     $err->errorEvent(ERROR_PARAMETER, "Invalid website / domain / expression ");
 }
 $siteentry = $kdb->getSiteSitename($site);
 // Does sitename exist - if not null already have an entry
 if ($siteentry != null) {
     // we need the siteid for the rules entry
     $siteid = $siteentry->getId();
 } else {