Advertisement
ASP_Volume2 Classes/ Frameworks/ OOP #43333

Logging IP's

This is basically an IP-logger, which keeps a record of if a person with that ip has been there before. This is great for counters which will prevent refresh-increasing the count. Just place the counter-events witin the correct function. The Welcome-part and not the Welcome back.

AI

Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kod źródłowy
original-source
<?php
if (!$filename) { //check if it is in the dir
  $filename = "default.txt"; //the default file
if (file_exists("$filename")) {
//echo "The file exists.<br>"; 
//early experiments
}
else {
$fp = fopen($filename,"a+");
fputs($fp,"999.555.444.21\n"); 
//999.555.444.21
//just so that there is something in the file 
//at the beginning
fclose($fp); 
}
}
//the main code
function ticker($filename,$remoted,$mode,$stuff) {
  $fp = fopen("checklist.txt","w+");
  $filename2 = "checklist.txt"; 
//the checklist 
//is just a base of comparison
// i found that comparing $REMOTE_ADDR and the
// other file had some flaws
// so writing a new one worked best with the 
// same content, it was probably because of the
// linefeed character
  fputs($fp,"$remoted\n");
  fclose($fp);
  $check_var = 0;
  $inlines = file($filename2);
  $inline = file($filename);
  $number_of_lines = count($inline);
  for($x = 0; $x <= $number_of_lines ;$x++){
  echo "$inlines[0]";
  echo "<br>$inline[$x]";
if ($inlines[0] == $inline[$x]) {
$check_var = 1;
}
}
return $check_var;  
}
if (!ticker($filename,$REMOTE_ADDR,null,null)) {
$fp = fopen($filename,"a+");
fputs($fp,"$REMOTE_ADDR\n");
fclose($fp);
echo "WELCOME FFS!";
}
else {
echo "WELCOME BACK FFS!";
}
  ?>
Oryginalne komentarze (3)
Odzyskane z Wayback Machine