Jump to content

stateofidleness

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

stateofidleness's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok so.... this ajax looks difficult ill research it some more tomorrow.. i isolated my php code to its own page and redid the code on the main page that "calls" the php page... no dice.. heh.. (couldn't be that easy) assuming i did this with ajax... im not sure how i would set up the "testing"... would i break it out of a foreach loop and then do individual calls from the "main" page to the ping.php page? one thing i forgot to add early on was that, if it detects the DVR as online, it outputs a hyperlink to the units IP address (this is all on a work intranet) if it detects it's down, it just displays the name in red font. it seems that AJAX will allow me to do what im wanting as far as the "update the page as it goes" idea instead of the entire page at once. I just don't know how to do it yet lol...
  2. OK! i got the foreach working!! im gonna research this ajax business and see if it would be a better route. On my foreach, it prints each element on a new line.. i tried to have multiple columns but not sure how to go about that.. once col1 reaches bottom of screen, then start a new column.. ideally i would have it refresh once it is finished with the loop... leaving the previous loop results visible.. and replacing with the current status as it goes through the loop.. if that makes sense where should i start with ajax? i think i started with php because it was easy to setup a webserver (usb drive ) with it and only language i could find with a ping function.
  3. well i lied about the "foreach" stuff lol. .guess it's been too long since i've used it.. any help? i've also never touched AJAX so wouldn't know where to start.. if it's worth it to learn for my purposes im all for it though!
  4. ahh ok. im familiar with foreach's and ill give it a try! Deer Park in Texas another issue im facing is im trying to have it display each item as it gets tested, instead it is going through the entire loop, then displaying all the stores at one time. my plan is to have the page refresh itself every so often to update the status of the DVRs. What is going to happen is it will run the whole loop again and THEN display it all at once... not really what I want... Id like it to go back through the loop from the beginning once it finishes and then start over without refreshing the page if possible. any ideas?
  5. I've ran across that PEAR thing a few times. Haven't played with it at all as I had already found a "solution." Until then, thoughts on my current setup?
  6. $info[10]["name"]="021 - Deer Park"; $info[10]["address"]="100.100.196.227"; $infocount = 10; $online = 0; $offline = 0; echo '<div id=header><div id=status1><table border="0" align=left>'; for($i=0; $i<=$infocount; $i++){ $ipconnect = "Packets: Sent = 1, Received= 0, Lost = 1 (100% loss)," ; $currentip = $info[$i]["address"]; exec("ping -n 1 $currentip", $output, $ret_val); if ( $ret_val == $ipconnect) { echo "<tr><td><span class=green><a href=http://" . $info[$i]["address"] . ">" . $info[$i]["name"] . "</a></span></tr></td>"; $online++; }else{ echo "<tr><td><span class=red>" . $info[$i]["name"] . "</span></tr></td>"; $offline++; } } echo '</tr></table></div>'; echo "DVRs Online: " . $online . "<br>DVRs Offline: " . $offline . "<br></div>"; ?> Seems like i have it working now (using the 3 parameters for "exec") but im wondering if i couldnt be doing this more efficiently. The first code snippet is an example of one the array elements. You can see that it goes through the 'for' loop and prints the status as it goes. This is causing a hiccup later on when I want to print the total online and total offline at the TOP of the page... I have no clue how to do this. Im also wondering if an array is the quickest way to do this. If i have to add a dvr later on, it will require retyping all the index numbers so as to keep them in numerical order. here is a screenshot (attached) of my output thus far: [attachment deleted by admin]
  7. Hey there! First post. Pretty new to PHP programming and here is my dilemma. I have an array of IP addresses (they are DVR units). I want to run through a loop pinging each unit and display only whether it is "$address UP" or "$address down". I have been successful in getting ping to actually work in php using "exec", "system", and "`ping... ". I've gotten the closest to what I want using "exec". Can this be done?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.