Location: PHPKode > projects > TraffStats > TraffStats-0.11.3/includes/act.newstatshostwizard.inc.php
<?php
/*
 * $Id: act.newstatshostwizard.inc.php,v 1.6 2007-04-03 15:29:07 zerwes Exp $
 * package: traffstats
 * (c) Klaus Zerwes zero-sys.net
 */

$status = false;

if($userobj->has_right("HOSTADMIN") || $userobj->has_right("SUPERADMIN")) {
	if(array_key_exists("ip", $_POST) && array_key_exists("snmpcommunity", $_POST) && array_key_exists("port", $_POST) ) {
		if(core::matchip($_POST["ip"])) {
			if( !function_exists("snmpwalkoid")) {
				$action_msg = $language->translate("missingsnmpmodule");
			} else {
				$debug->mark("start SNMP for IF-MIB");
				$snmparr = snmphelper::buildSNMPArray($_POST["ip"], $_POST["port"], $_POST["snmpcommunity"]);
				if(is_array($snmparr)) {
					$snmparr["hostname"] = snmpget ( $_POST["ip"].":".$_POST["port"], $_POST["snmpcommunity"], "sysName.0" );
					$debug->debugarray($snmparr, "snmparr");
					$status = true;
					$actionstack->set_displayaction("newstatshostwizardifaces");
				} else {
					$action_msg = $language->translate("snmpconnectionfailed");
				}
				$debug->mark("done SNMP for IF-MIB");
			}
		} else {
			$action_msg = $language->translate("ipnotvalid");
		}
	} else {
		$action_msg = $language->translate("missingdata");
	}
} else {
	$action_msg = $language->translate("no_right_to_do_this");
}

if ($status) {
	$actionstack->set_displayaction("newstatshostwizardifaces");
} else {
	$actionstack->set_displayaction($save_act);
}

unset($status);

?>
Return current item: TraffStats