PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Wed Jan 18, 2006 9:05 pm
ok this is my script
Code: Select all
<?php
$snf = str_replace(" ", "", $sn);
if ("nickman013" == $snf) header('Location:/nvideos/Password.php');
if(gotti1 == $page) include("GottiVideo.php");
if(gotti2 == $page) include("/GottiVideo2.php");
if ($_SERVER['remote_addr'] != '68.195.158.89') {
$date = date("F j, Y, g:i a");
$sn2 = "$snf";
$ip = @$REMOTE_ADDR;
$filename = 'visit_log.htm';
$somecontent = "<tr><td align=center>$sn2</td><td align=center>$page</td><td align=center>$date</td><td align=center>$ip</td></tr>";
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success $filename";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
}
?>
i dont want it to log me in the log..
thank you
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Wed Jan 18, 2006 9:09 pm
run this code in a seperate file
Code: Select all
if ($_SERVER['remote_addr'] != '68.195.158.89') {
var_dump($_SERVER['remote_addr']);
} else {
echo 'detecting ip correctly';
}
what do you get
edit - do'h, remote_addr is case sensitive, change it to REMOTE_ADDR
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Wed Jan 18, 2006 9:52 pm
this is solved, anybody following this thread, the final script is
Code: Select all
<?php
$snf = str_replace(" ", "", $sn);
if ("nickman013" == $snf) header('Location:/nvideos/Password.php');
if(gotti1 == $page) include("GottiVideo.php");
if(gotti2 == $page) include("/GottiVideo2.php");
if ($_SERVER['remote_addr'] != '68.195.158.89') {
$date = date("F j, Y, g:i a");
$sn2 = "$snf";
$ip = @$REMOTE_ADDR;
$filename = 'visit_log.htm';
$somecontent = "<tr><td align=center>$sn2</td><td align=center>$page</td><td align=center>$date</td><td align=center>$ip</td></tr>";
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success $filename";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
}
?>
thanks to jshpro2, this problem was solved