$action = GetVariable("action"); $id = GetVariable("id"); $sitename = GetVariable("sitename"); $siteaddress = GetVariable("siteaddress"); $sitecontact = GetVariable("sitecontact"); //print_r($_POST); /* determine action */ if ($action == "editform") { DisplaySiteForm("edit", $id); } elseif ($action == "addform") { DisplaySiteForm("add", ""); } elseif ($action == "update") { UpdateSite($id, $sitename, $siteaddress, $sitecontact); DisplaySiteList(); } elseif ($action == "add") { AddSite($sitename, $siteaddress, $sitecontact); DisplaySiteList(); } elseif ($action == "delete") { DeleteSite($id); } else { DisplaySiteList(); } /* ------------------------------------ functions ------------------------------------ */ /* -------------------------------------------- */ /* ------- UpdateSite ------------------------- */ /* -------------------------------------------- */ function UpdateSite($id, $sitename, $siteaddress, $sitecontact) { /* perform data checks */ $sitename = mysql_real_escape_string($sitename); $siteaddress = mysql_real_escape_string($siteaddress);
function rebuildsites(){ $q=new mysql(); $sql="SELECT uri FROM dansguardian_events"; $results=$q->QUERY_SQL($sql,'artica_events'); while ($ligne = mysql_fetch_array($results)) { if(preg_match('#^.+?:\/\/(.+?)[\/:\s]#',$ligne["uri"],$re)){ $domain=$re[1]; AddSite($domain); }else{ echo "ERROR: unable to found the domain in \"{$ligne["uri"]}\"\n"; } } }