when i try to program my snmp then apply to the CodeIgniter framework, I can not display it
this is my code
<?php foreach($monitor as $mnt){ ?>
<?php
// Set Variables:
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("monitor") or die (mysql_error());
$hasil = mysql_query("SELECT * FROM device") or die (mysl_error());
$row = mysql_fetch_array($hasil);
// Clean output function - Removes the extras given by SNMP
function clean_output($string) {
$clean_output = preg_replace("/[A-Za-z]*:[ ]/", "", $string);
$clean_output = preg_replace("/[(][0-9]*[)][ ]/", "", $clean_output);
$clean_output = str_replace("Gauge32", "", $clean_output);
$clean_output = str_replace("Counter32", "", $clean_output);
$clean_output = preg_replace("/[(][0-9][)]/", "", $clean_output);
return $clean_output;
}
// Create specific OIDs
$sysUptime = "1.3.6.1.2.1.1.3.0";
# Check that we are able to contact the system, If we are then run the rest of the SNMP gets.
$oo8 = clean_output(snmpget($row['host'],$row['comm'],$sysUptime));
if($oo8 != "") {
// Now we know that we can contact the device, run the other SNMP gets.
$oo8 = clean_output(snmpget($row['host'],$row['comm'],$sysUptime));
}
// Show the System stats at the start of the table.
echo "<center><br><b>Uptime:</b></br></center><center> $oo8</center>";
?>
<?php } ?>
The contents of a folder in the controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class home extends CI_Controller {
public function index()
{
$comp = array(
"header" => $this->load->view("header",array(),true),
"monitor" => $this->html_monitor(),
);
$this->load->view("index",$comp);
}
public function html_monitor(){
$data = array(
"device" => $this->mymodel->GetDevice(),
);
return $this->load->view("monitor",$data,true);
}
}