PDA

View Full Version : [code] remember hostid & groupid


globifrosch
02-09-2005, 16:54
add this to config.inc.php and your browser remembers the hostid or groupid (everywhere in the webfrontend).

session_start();

if ($_GET['groupid'] != "") // group id changed
{
$_SESSION['groupid'] = $_GET['groupid'];
}
else // set groupid by rememberd value
{
$_GET['groupid'] = $_SESSION['groupid'];
}



if ($_GET['hostid'] != "") // host id changed
{
$_SESSION['hostid'] = $_GET['hostid'];
}
else // set host id by rememberd value
{
$_GET['hostid'] = $_SESSION['hostid'];
}

cheers'
thomas

mlevin
02-09-2005, 20:44
IFAIK, Alexei is still closed for contributions, is he not? :)

But that patch works like a charm!

mlevin
02-09-2005, 20:56
Except, that id doesn't work with Host Configuration. May be somewhere else too. :(

So, it is up to Alexei, to officially provide some sort of that functionality in the product.

globifrosch
03-09-2005, 11:46
just checked out the cvs version of the php frontend. there's something like that. it remeber hostid,groupid (probably more...) per page.

globifrosch
05-09-2005, 10:23
no more errors in hosts.php...


if (! preg_match('/hosts\.php/',$_SERVER["SCRIPT_NAME"]))
{
session_start();

if ($_GET['groupid'] != "")
{
$_SESSION['groupid'] = $_GET['groupid'];
}
else
{
$_GET['groupid'] = $_SESSION['groupid'];

}


if ($_GET['hostid'] != "")
{
$_SESSION['hostid'] = $_GET['hostid'];
}
else
{
$_GET['hostid'] = $_SESSION['hostid'];
}

if ($_GET['screenid'] != "")
{
$_SESSION['screenid'] = $_GET['screenid'];
}
else
{
$_GET['screenid'] = $_SESSION['screenid'];
}
}

marc
07-09-2005, 22:24
unfortunately i didnt see something like that in cvs code yet.

Alexei
08-09-2005, 08:50
It is there since 1st of September or something.

marc
08-09-2005, 09:56
ok, got it.. sorry for being blind.