Ok...here is the answer to what I was trying to do. I will be posting on SourceForge or planetsourcecode here soon. You guys get to have it first! π I know its a very simple problem but the application and what I could be used for and what you could add to it is amazing. I used 1 If, 2 Exits, 1 Foreach and thats about it. π Make sure that you have permission to write files. I used w+ but I am sure you could use others. It was easy for me. I own the server. Ahhh the power of dedicated boxes.
LOL.... So here it is.
------------countme.php-------------------
<?php
$go=1;
include("keeptrack.inc");
$ip = $GLOBALS['REMOTE_ADDR'];
$real_ip=str_replace(".","",$ip);
foreach ($ip_log as $logged_ip) {
if($real_ip == $logged_ip){
$go=0;
}
}
if($go==1){
$date_time = date("F j, Y, g:i a");
$hits++;
$new_logged="<?php \$hits=$hits; \$ip_log = array ($real_ip,$current_log); \$current_log=\"$current_log,$real_ip\"; \$last_dated='$date_time'; ?>";
$file = fopen("keeptrack.inc" , "w+");
fwrite ($file,$new_logged);
fclose($file);
exit;
}
?>
---------------keeptrack.inc------------------
<?php $hits=1; $ip_log = array (255255255255); $current_log="255255255255"; $last_dated='January 20, 2003, 12:10 am'; ?>
---------------End of keeptrack.inc---------
I had to edit this b/c when the real world started to hit it ... yeah it logged people over and over... π So....I restructured it and made it so it didn't do that anymore. If you use this code please provide a link back to www.brokenformula.com ... Thank you.