Hi
I need some help with some code: :p
If it can be done, i would like to print out the value of the array.
Then if i wont to, then change the value, and insert it with the function snmp_set()
<?php
$connect = "10.x.x.x";
$community_set = "set";
$community_read = "read";
function snmp_set() {
global $key;
global $connect;
global $community_set;
global $community_read;
//*******************************************
//if $index = 2 it will change the value with snmpset if i use $_GET['$key']; i get an error because it does not have any data.
//********************************************
$index = 2;//$_GET['$key'];
$object_id = "enterprises.1824.1.3.1.3.$index";
$value = $_GET['oid'];
// snmpset function kaldes når en knap bliver activeret.
snmpset("$connect", "$community_set", "$object_id", 's', "$value");
}
//SNMPWALK
$a = snmpwalk("$connect", "$community_read", "1.3.6.1.4.1.1824.1.3.1.3");
echo "<table border='1'><tr><th>READ DATA</th><th>WRITE DATA</th><th>SUBMIT</th></tr>";
foreach ($a as $key => $val){
if( isset($_GET['action']) && ($_GET['action'] == 'snmp_set')) {
snmp_set();
}
echo "<tr><td>";
echo "<form action='' method='GET'>";
echo "<input type='text' name='$key' value='$val'>";
echo "</input></td>";
echo "<td>";
echo "<input type='text' name='oid'>";
echo "</td><td>";
echo "<input type='hidden' name='action' value='snmp_set'>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
echo "</td><td></td>";//the last td only for test
}
echo "</table>";
?>