IP Address Management

Discussion in 'Windows Desktop Systems' started by kcnychief, Aug 12, 2005.

  1. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    I have alot of clients that I need to manage IP Addresses for. They all have DSL or Cable and none of them are static, so once and a great while they change. I have them all trained to visit http://www.whatismyip.com if the address changes and report back to me, so that is all working good. My only question is, if anyone else out there manages alot of IP's, how do you manage them?

    Currently I have them in an .xls on my Axim, but I didn't know if anyone else out there had other methods, something that might be easier for me or more convenient. Anyone got some input on that?
     
  2. ThePatriot

    ThePatriot -=[BOHICA!]=- Political User

    Messages:
    1,742
    Location:
    Pennsylvania
    We manage about 200 clients in about the same way. Only difference is, all of our systems are Unix based, and we simply wrote a little cron that runs every 15 min and reports the IP of the client and saves it to a log file. We did put a small piece of code on our website that returns the viewers ip, but that's not much different than whatismyip.com. It is a bit easier for us that way because we put a shortcut to the site on their desktops and they can get to it fairly quickly.
     
  3. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    Yeah, I put the shortcut to the URL on the desktop too, I just need the users to report changes. No cron jobs here :)
     
  4. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    I keep track of my network's IP scheme using an spreadsheet also.
     
  5. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    am assuming an axis is some kind of pda device, if it has mobile connectivity could you not simply have a script on a server somewhere that you get them to go to which then catches the IP address and stores it in a database for you.

    Something like a Scheduled Task that runs periodically, something that for example uses MSIE or some scripted version of MSIE that checks a url like http://www.domain.com/ip.php?id=12367834 that would then get the ip address from the $_SERVER['REMOTE_ADDR'] variable and then stores that in a database using the id value. You could then look this up with another script that just dumps the information into a text file that you can read, or into a CSV that you could import into Excel
     
  6. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    'cuse the double post, but they are separate really... honest :p
    and yeah, I got bored...

    When you set them up you goto the add page and add them to the system, this should return you an ip number to use for the client. You would then create a shortcut to open http://www.domain.com/ip.php?id=123

    The show page is then able to just dump the information out of the database and output into plain text.

    A PHP version might look something like this

    SQL Table creation
    Code:
    CREATE TABLE dsl_ip (
        uid INT( 11 ) NOT NULL AUTO_INCREMENT,
        name TEXT NOT NULL,
        ip TEXT NOT NULL,
        PRIMARY KEY ( uid )
    );
    ip.php
    PHP:
    <?php
    $sqldb 
    mysql_connect('localhost','username','password');
    mysql_select_db('dsl');

    $uid strip_tags(trim($_GET['id']));
    $uid = (int)$uid;       // just to make sure its an integer

    $ip $_SERVER['REMOTE_ADDR'];
    $uSql "UPDATE TABLE dsl_ip ( ip ) VALUES ( '{$ip}' ) WHERE uid = '{$uid}'";
    $uResult mysql_query($uSql$sqldb);

    // maybe give them a thankyou message
    echo "Thank you";
    ?>
    add.php
    PHP:
    <?php
    if ($_POST['submit'] == "Add") {
        
    $sqldb mysql_connect('localhost','username','password');
        
    mysql_select_db('dsl');
        
        
    $desc strip_tags(trim($_POST['desc']));
        
        
    $ip $_SERVER['REMOTE_ADDR'];
        
    $iSql "INSERT INTO dsl_ip ( ip, desc ) VALUES ( '{$ip}', '{$desc}' )";
        
    $iResult mysql_query($iSql$sqldb);
        
    $uid mysql_insert_id($iResult);
        
        echo 
    "Client Added ID is {$uid}";
    } else {
    $html =<<<EOF
    <html>
    <head><title>Add New Client</title></head>
    <body>
    <form method="post" action="
    $_SERVER['PHP_SELF']">
    <label for="desc">Description: <input type="text" name="desc" size="30"/></label>
    <input type="submit" name="submit" value="Add Client"/>
    </form>
    </body>
    </html>
    EOF;
    echo 
    $html;
    }
    ?>
    show.php
    PHP:
    <?php
    header
    ("Content-Type: text/plain");

    $sqldb mysql_connect('localhost','username','password');
    mysql_select_db('dsl');

    $sSql "SELECT ip, desc FROM dsl_ip ORDER BY uid ASC";
    $sResult mysql_query($sSql$sqldb);

    while(
    $row mysql_fetch_array($sResult)) {
        echo 
    "{$row['ip']} - {$row['desc']}\n";
    }
    ?>
     
    zeke_mo, muzikool and kcnychief like this.
  7. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    That is crazy dude, did you just write that from scratch in like 10-20 minutes?

    In awe of you, reps for just being crazy smart :eek:
     
  8. LordOfLA

    LordOfLA Godlike!

    Messages:
    7,027
    Location:
    Maidenhead, Berkshire, UK
    PHP/MySQL is nice for just throwing stuff together adhoc in 20-30 minutes :)
     
  9. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    yar, just chucked it together, I did forget to mention though that you need to have a database called 'dsl', if its called something else then change the
    mysql_select_db('dsl'); to mysql_select_db('name of database');
     
  10. scotty588

    scotty588 OSNN Addict

    Messages:
    64
    Location:
    San Diego, CA
    I don't know if this would help but theres this site called no-ip.org It gives you a url for other people to connect to and then the person runs a program on their system and it keeps track of the persons ip by relaying it to the no-ip site. Maybe you can some how incorporate that into ip tracking.