PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Fernando André   PHP Docsis Config of Cable Modem   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Docsis Config of Cable Modem
Query cable modem configuration via SMNP
Author: By
Last change:
Date: 7 years ago
Size: 1,700 bytes


Class file image Download
require 'Docsismodem.php';

$pdo = new PDO(

if (
array_key_exists("macaddr", $_GET)) {
$mac = $_GET['macaddr'];
$mac = str_replace(":", "", $mac);
$mac = str_replace(".", "", $mac);
} else {
$mac = "";

// This get's me the last ip commited to the cable modem
// I use it to know where the CM lives
// Also one can use reverse DNS if your networking is using such a thing
// check PEAR packages for DNS Queries
$sql = "SELECT macaddr, lastip, serialnum FROM docsismodem WHERE macaddr = ? ";
$sth = $pdo->prepare($sql);

$a = null;
foreach (
$sth->fetchAll(PDO::FETCH_CLASS) as $modem ) {
$dm = new DM_Model_Docsismodem();
$dm->ipaddr = $modem->lastip;
$dm->macaddr = $modem->macaddr;
$a = $dm->remoteQuery();

    <title>TX Information page, <?php print $modem->macaddr ?></title>
    <LINK href="bluedream.css" rel="stylesheet" type="text/css">
    <td><?php print $modem->macaddr ?> , IP: <?php print $a['ip'] ?></td>
    <td><?php print ($a['tx']/10) ?></td>
    <td><?php print ($a['snr']/10) ?></td>
    <td><?php print ($a['rx']/10) ?></td>
    <td><b>firmware version</b></td>
    <td><?php print $a['version'] ?></td>
    <form action="" method="get" name="p">
        <input type="text" name="macaddr" value="<?php print $mac ?>" />
        <input type="submit" value="Ver" />