include_once 'ressources/class.squid.inc';
include_once 'ressources/class.system.network.inc';
if (isset($_GET["items"])) {
    items();
    exit;
}
if (isset($_GET["popup-ad-js"])) {
    js_popup_ad();
    exit;
}
if (isset($_GET["popup-ad-tab"])) {
    tab_ad();
    exit;
}
if (isset($_GET["popup-ad-popup"])) {
    popup_ad();
    exit;
}
if (isset($_POST["hostname"])) {
    popup_save();
    exit;
}
if (isset($_GET["popup-ad-groups"])) {
    popup_groups();
    exit;
}
if (isset($_POST["groups"])) {
    popup_groups_save();
    exit;
}
if (isset($_GET["delete-ad-js"])) {
<?php
if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.squid.inc');
	include_once('ressources/class.system.network.inc');
	
	
	if(isset($_GET["items"])){items();exit;}
	if(isset($_GET["popup-ad-js"])){js_popup_ad();exit;}
	if(isset($_GET["popup-ad-tab"])){tab_ad();exit;}
	if(isset($_GET["popup-ad-popup"])){popup_ad();exit;}
	if(isset($_POST["hostname"])){popup_save();exit;}
	if(isset($_GET["popup-ad-groups"])){popup_groups();exit;}
	if(isset($_POST["groups"])){popup_groups_save();exit;}
table();



function js_popup_ad(){
	$tpl=new templates();
	$page=CurrentPageName();
	header("content-type: application/x-javascript");
	$md5=$_GET["md5"];
	$title=$tpl->javascript_parse_text("{new_connection}");
	if($_GET["md5"]<>null){
		$q=new mysql_squid_builder();
		$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT hostname FROM hotspot_activedirectory WHERE zmd5='$md5'"));
		$title=$ligne["hostname"];
	}