Free Web Hosting Forum
(#1 (permalink))
Old
aPhpHelper's Avatar
Senior Member
aPhpHelper is on a distinguished road
 
Posts: 206
Join Date: Nov 2008
Location: United Kingdom
Send a message via ICQ to aPhpHelper Send a message via AIM to aPhpHelper Send a message via MSN to aPhpHelper Send a message via Skype™ to aPhpHelper
Default A good IP logger - 03-03-2009, 07:03 PM

Good IP Logger [v1.1]
Notice
This logger is compatible with 000webhost, but I have no idea on how to use it with the Site Builder. So don't ask me.

Instructions
1. Paste the code into a blank PHP file. For this example, the filename is "iplogger.php";
2. Create a blank .txt file called ip_log.txt
3. CHMOD ip_log.txt to 777.
4. Add this code to the top of your scripts:
PHP Code:
require_once("iplogger.php"); 
5. To view your IP log, go to yoursite.com/iplogger.php?az=view

Code
PHP Code:
<?php
// IP Logger by phpHelper.
function runlog() {
$str $_SERVER["REMOTE_ADDR"];
$str .= "\t";
$str .= mktime();
$str .= "\t";
$str .= $_SERVER["HTTP_USER_AGENT"];
$str .= "\t";
$browser get_browser(nulltrue);
$str .= $browser["browser"];
$str .= "\n";
@
$fp fopen("ip_log.txt""ab");
if(!
$fp) {
return 
false;
}
fwrite($fp$str);
fclose($fp);
return 
true;
}
function 
writeLog() {
echo 
"<table border=\"0\">";
echo 
"<tr>";
echo 
"<td><strong>IP Address</strong></td>";
echo 
"<td><strong>Visitor Time</strong></td>";
echo 
"<td><strong>HTTP User-Agent</strong></td>";
echo 
"<td><strong>Browser Name</strong></td>";
echo 
"</tr>";
$n file_get_contents("ip_log.txt");
$log explode("\n"$n);
foreach(
$entryraw as $log) {
$entry explode("\t"$entryraw);
echo 
"<tr>";
echo 
"<td>".$entry[0]."</td>";
echo 
"<td>".date("H:i, d M Y"$entry[1])."</td>";
echo 
"<td>".$entry[2]."</td>";
echo 
"<td>".$entry[3]."</td>";
echo 
"</tr>";
echo 
"</table>";
}
@
$action $_REQUEST["az"];
if(
$action == "view") {
echo 
"Server time is <strong>".date("O")."</strong><br />";
writeLog();
exit;
}
if(empty(
$action)) {
runlog();
}
?>
Hope you enjoy this wonderful tool!

Last edited by aPhpHelper; 07-27-2009 at 09:55 AM. Reason: fixed
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Member
fireworking is on a distinguished road
 
Posts: 83
Join Date: Dec 2008
Default 03-04-2009, 12:32 AM

I wonder where you got it from. Tip: if you want to make it faster, why dont you concatenate the whole thing into one string?


PHP Code:
function log() { 
$str $_SERVER["REMOTE_ADDR"] . "\t" mktime() . "\t" $_SERVER["HTTP_USER_AGENT"] . "\t"
$browser get_browser(nulltrue); 
$str .= $browser["browser"]; 
$str .= "\n"
@
$fp fopen("ip_log.txt""ab"); 
if(!
$fp) { 
return 
false



Get traffic really easily
This is no scam. I have gotten 8,000 unique visitors in the last month with this.
(Get 100 free points when you get 100 points)
Reply With Quote
(#3 (permalink))
Old
aPhpHelper's Avatar
Senior Member
aPhpHelper is on a distinguished road
 
Posts: 206
Join Date: Nov 2008
Location: United Kingdom
Send a message via ICQ to aPhpHelper Send a message via AIM to aPhpHelper Send a message via MSN to aPhpHelper Send a message via Skype™ to aPhpHelper
Default 03-04-2009, 07:12 AM

@above
I made it.
Reply With Quote
(#4 (permalink))
Old
doctor_promo@yahoo.com's Avatar
Junior Member
doctor_promo@yahoo.com is on a distinguished road
 
Posts: 26
Join Date: Aug 2008
Location: Philippines
Default 11-22-2009, 06:42 AM

Quote:
Originally Posted by aPhpHelper View Post
Good IP Logger [v1.1]
Notice
This logger is compatible with 000webhost, but I have no idea on how to use it with the Site Builder. So don't ask me.

Instructions
1. Paste the code into a blank PHP file. For this example, the filename is "iplogger.php";
2. Create a blank .txt file called ip_log.txt
3. CHMOD ip_log.txt to 777.
4. Add this code to the top of your scripts:
PHP Code:
require_once("iplogger.php"); 
5. To view your IP log, go to yoursite.com/iplogger.php?az=view

Code
PHP Code:
<?php
// IP Logger by phpHelper.
function runlog() {
$str $_SERVER["REMOTE_ADDR"];
$str .= "\t";
$str .= mktime();
$str .= "\t";
$str .= $_SERVER["HTTP_USER_AGENT"];
$str .= "\t";
$browser get_browser(nulltrue);
$str .= $browser["browser"];
$str .= "\n";
@
$fp fopen("ip_log.txt""ab");
if(!
$fp) {
return 
false;
}
fwrite($fp$str);
fclose($fp);
return 
true;
}
function 
writeLog() {
echo 
"<table border=\"0\">";
echo 
"<tr>";
echo 
"<td><strong>IP Address</strong></td>";
echo 
"<td><strong>Visitor Time</strong></td>";
echo 
"<td><strong>HTTP User-Agent</strong></td>";
echo 
"<td><strong>Browser Name</strong></td>";
echo 
"</tr>";
$n file_get_contents("ip_log.txt");
$log explode("\n"$n);
foreach(
$entryraw as $log) {
$entry explode("\t"$entryraw);
echo 
"<tr>";
echo 
"<td>".$entry[0]."</td>";
echo 
"<td>".date("H:i, d M Y"$entry[1])."</td>";
echo 
"<td>".$entry[2]."</td>";
echo 
"<td>".$entry[3]."</td>";
echo 
"</tr>";
echo 
"</table>";
}
@
$action $_REQUEST["az"];
if(
$action == "view") {
echo 
"Server time is <strong>".date("O")."</strong><br />";
writeLog();
exit;
}
if(empty(
$action)) {
runlog();
}
?>
Hope you enjoy this wonderful tool!
Question: I am a real neophyte when it comes to this. where do I put this, require_once("iplogger.php"); and what do I do with this, 3. CHMOD ip_log.txt to 777.
Your assistance would be greatly appreciated! Thanks in advance!
Reply With Quote
(#5 (permalink))
Old
Junior Member
tructuyenvietnam.com is on a distinguished road
 
Posts: 6
Join Date: Sep 2010
Default 09-05-2010, 01:36 AM

thanks so much!
Reply With Quote
(#6 (permalink))
Old
Snuupy's Avatar
Senior Member
Snuupy is on a distinguished road
 
Posts: 375
Join Date: Aug 2010
Location: Under your bed! O.O
Default 09-05-2010, 02:44 AM

Don't you think something like statcounter would be better?


You can visit the 000webhost IRC Channel at irc.freenode.net/#000webhost =)

BEFORE CREATING A THREAD: Insert problem here: http://google.com/

Please add karma if someone has helped you!
Reply With Quote
(#7 (permalink))
Old
Senior Member
Joshabar123 is on a distinguished road
 
Posts: 577
Join Date: Aug 2010
Location: Earth
Default 09-05-2010, 03:09 AM

Quote:
Originally Posted by Snuupy View Post
Don't you think something like statcounter would be better?
This is actually helpful for people that would want to use the IP Deny Manager option in the cPanel.


Joshua

Last edited by Joshabar123; 09-17-2010 at 01:54 AM.
Reply With Quote
(#8 (permalink))
Old
Junior Member
ahmedb is on a distinguished road
 
Posts: 6
Join Date: Oct 2011
Default 02-13-2012, 02:42 AM

Code:
<?php 
// IP Logger by phpHelper. 
function runlog() { 
$str = $_SERVER["REMOTE_ADDR"]; 
$str .= "\t"; 
$str .= mktime(); 
$str .= "\t"; 
$str .= $_SERVER["HTTP_USER_AGENT"]; 
$str .= "\t"; 
$browser = get_browser(null, true); 
$str .= $browser["browser"]; 
$str .= "\n"; 
@$fp = fopen("ip_log.txt", "ab"); 
if(!$fp) { 
return false; 
} 
fwrite($fp, $str); 
fclose($fp); 
return true; 
} 
function writeLog() { 
echo "<table border=\"0\">"; 
echo "<tr>"; 
echo "<td><strong>IP Address</strong></td>"; 
echo "<td><strong>Visitor Time</strong></td>"; 
echo "<td><strong>HTTP User-Agent</strong></td>"; 
echo "<td><strong>Browser Name</strong></td>"; 
echo "</tr>"; 
$n = file_get_contents("ip_log.txt"); 
$log = explode("\n", $n); 
foreach($entryraw as $log) { 
$entry = explode("\t", $entryraw); 
echo "<tr>"; 
echo "<td>".$entry[0]."</td>"; 
echo "<td>".date("H:i, d M Y", $entry[1])."</td>"; 
echo "<td>".$entry[2]."</td>"; 
echo "<td>".$entry[3]."</td>"; 
echo "</tr>"; 
echo "</table>"; 
} 
@$action = $_REQUEST["az"]; 
if($action == "view") { 
echo "Server time is <strong>".date("O")."</strong><br />"; 
writeLog(); 
exit; 
} 
if(empty($action)) { 
runlog(); 
} 
?>
i get an error at line 50, anyone wanna help please?
Reply With Quote
(#9 (permalink))
Old
Senior Member
Firebirds is on a distinguished road
 
Posts: 252
Join Date: Feb 2012
Default 02-13-2012, 04:28 PM

Did you copy ALL of the script? I only counted 47 lines.


All your problems magically solved.
How to use custom domain. | Account under review? | Can I do this/whatever?
Have a happy magical day
~Firebirds
Reply With Quote
(#10 (permalink))
Old
Member
Brero-San is on a distinguished road
 
Posts: 37
Join Date: Feb 2012
Default 02-20-2012, 10:32 PM

I get this same error D: which happens to be ?>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com