ugrás a tartalomhoz

Archívum - Már 22, 2004 - Fórum téma

PHP IP rögzítés

Anonymous · 2004. Már. 22. (H), 22.10
Üdv!

Az a gondom, hogy nem rögzíti az IP címet ez a kis
prg.Én persze nem értek hozzá, ha v.ki tud , akkor segítsen!
Előre is tanx.
<?

$datafile="adat.txt";
$seperator = chr(14).chr(1);
$lseperator = chr(0).chr(0).chr(0);


chmod($datafile,0666);
if($act == "sign") {

if(filesize($datafile)>0) {
$x=fopen($datafile,"r+");
$data = fread($x,filesize($datafile));
$start=0;
$arr = explode($lseperator,$data);
echo "&total=".(count($arr)+1)."&";
fclose($x);
}

$name = str_replace("<?","PHPCODE-Start",$name);
$name = str_replace("?>","PHPCODE-Start",$name);
$name = str_replace("&","^^",$name);

$email = str_replace("<?","PHPCODE-Start", $email);
$email = str_replace("?>","PHPCODE-Ends", $email);
$email = str_replace("&","^^", $email);

$site = str_replace("<?","PHPCODE-Start", $site);
$site = str_replace("?>","PHPCODE-Ends", $site);
$site = str_replace("&","^^", $site);

$comm = str_replace("<?","PHPCODE-Start", $comm);
$comm = str_replace("?>","PHPCODE-Ends", $comm);
$comm = str_replace("&&","^^", $comm);

$ip= "";
$_SERVER["SERVER_ADDR"];

$f=fopen($datafile,"a+");

if(filesize($datafile)==0) {
$strx = "$name$seperator$email$seperator$site$seperator$comm$seperator$ip";
fwrite($f,$strx);
fclose($f);
}
else {
fclose($f);
$f=fopen($datafile,"w");
$strx = "$name$seperator$email$seperator$site$seperator$comm$seperator$ip$lseperator$data";
fwrite($f,$strx);
fclose($f);
}
echo "&done=1&";
}
if($act == "view") {
if(filesize($datafile)==0) {
report("Nincs több bejegyzés!");
//echo "&total=0&";
exit;
}

$f=fopen($datafile,"r+");
$data = fread($f,filesize($datafile));
fclose($f);
$arr = explode($lseperator,$data);
echo "&total=".count($arr)."&";

$to =0;
if($start + $entriespep > count($arr)) {
$to = count($arr);
echo "&nomore=1&";
}
else
$to = $start + $entriespep-1;
echo "&current=".($start)."..".($to);
$final="";
$start--;

if($start<0) { $start++; $to++; }


for($i=$start; $i<$to; $i++) {
$carr=explode($seperator,$arr[$i]);
$final .= "<i>Bejegyzes ".($i+1)."</i>