dbillings Posted August 28, 2007 Share Posted August 28, 2007 I can't get my array's to echo. The diplay pukes out the following. IP: Array Unix: IP: Array Unix: <?php ############################## ### Users online script ### ver. 8/26/07 ############################## $ip = $_SERVER['REMOTE_ADDR']; $filename = "usersonline.txt"; if (is_writable($filename)) { $handle = fopen($filename, "r"); if (filesize($filename) > 0) { $contents = fread($handle, filesize($filename)); fclose($handle); } $handle = fopen($filename, "a"); $iptime = $_SERVER['REMOTE_ADDR']."@@@@".time()."****"; $seperate = explode("****", $contents); $remote_addr = array(); $time_out = array(); foreach ($seperate as $value) { list($remote_addr[], $time_out[]) = split('@@@@', $seperate); } if (count($remote_addr) == count($time_out)) { $counter = count($remote_addr); for ($i=0; $i < $counter; $i++) { // I cant' get this array to display. // Neither $remote_addr nor $time_out display. Any ideas? echo "IP: "; echo $remote_addr[$i]; echo " Unix: "; echo $time_out[$i]; echo " <br />"; } } if (fwrite($handle, $iptime) === FALSE) { echo "File: $filename cannot be written too."; exit; } fclose($handle); }else{ echo "The $filename is not writable."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/ Share on other sites More sharing options...
MadTechie Posted August 28, 2007 Share Posted August 28, 2007 do a print_r($remote_addr), so check the array, it should reveal the problem Quote Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/#findComment-335847 Share on other sites More sharing options...
dbillings Posted August 28, 2007 Author Share Posted August 28, 2007 Thanks my brotha from anotha mutha. I'll give that a try. Quote Link to comment https://forums.phpfreaks.com/topic/66967-cant-iterate-my-array/#findComment-335849 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.