Ips

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
Rawr

Ips

Post by Rawr »

How do i get the ips of the people who post? this guy keeps posting bad comments and i wanna make it so he cant view my site anymore. Thanks
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi,

You would have to edit gbook.php to show that. If I find some time I will see what I can do this weekend, but no promises... Alternatively you could check inside your log files (much work).

Regards
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ivan
Posts: 1
Joined: Sun Aug 28, 2005 11:26 pm

Post by ivan »

Sorry if i crank up some old post here :lol:, but i think it could be usefull for some users..


First of all, you need a decent text editor like PHP Designer 2005. I'm gonna explain this bit by bit, using standard modification used in similar PHP source. Basically, it's just when i said [ FIND ], you will find first matching code, do some replacement or addition after, etc.. i hope a n00bi like me could easily understand this method ;).

I'm using
#
#--[command]----
#

as explanatory action, required code would be right below them. This modding only tested for gbook v 1.3.3.
Here we go..

Code: Select all


#################################################################
# Adding an IP tracking for PHP guestbook V 1.33                #
# Script provided free by PHPJunkyard - Free PHP scripts        #
# http://www.phpjunkyard.com/                                   #
# Mods by Ivan :: id_ivan[at]yahoo[dot]com                      #
#################################################################
# 
#-----[ OPEN ]------------------------------------------------ 
#
gbook.php
# 
#-----[ FIND ]------------------------------------------------ 
# 
elseif($a=="add") {
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
        $ipaddr=gbook_input($_SERVER['REMOTE_ADDR']);
# 
#-----[ FIND ]------------------------------------------------ 
#
    	addEntry($name,$from,$email,$url,$comments,$isprivate);
# 
#-----[ REPLACE ]---------------------------------------------
#
    	addEntry($ipaddr,$name,$from,$email,$url,$comments,$isprivate);
# 
#-----[ FIND ]------------------------------------------------ 
# 
function print_secimg($name,$from,$email,$url,$comments,$isprivate,$message=0) {
# 
#-----[ REPLACE ]--------------------------------------------- 
#
function print_secimg($ipaddr,$name,$from,$email,$url,$comments,$isprivate,$message=0) {
# 
#-----[ FIND ]------------------------------------------------ 
# 
Please type in the security number displayed above:
<input type="text" size="7" name="secnumber" maxlength="5" id="input"></p>
<p>&nbsp;
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
<input type="hidden" name="name" value="<?php echo $ipaddr; ?>">
# 
#-----[ FIND ]------------------------------------------------ 
# 
list($name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$num]);
# 
#-----[ REPLACE ]--------------------------------------------- 
#
list($ipaddr,$name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$num]);
# 
#-----[ FIND ]------------------------------------------------ 
# 
<font class=\"smaller\">E-mail:</font> ";
if (strlen($email)>0) {
echo "<a href=\"mailto:$email\" target=\"_blank\" class=\"smaller\">$email</a>";
}
echo "</td>
# 
#-----[ REPLACE ]--------------------------------------------- 
#
<font class=\"smaller\">E-mail:</font> ";
if (strlen($email)>0) {
echo "<a href=\"mailto:$email\" target=\"_blank\" class=\"smaller\">$email</a><br>IP: $ipaddr";
}
else {
echo "<br>IP: $ipaddr";
}
echo "</td>
# 
#-----[ FIND ]------------------------------------------------ 
# 
function addEntry($name,$from,$email,$url,$comments,$isprivate="0") {
# 
#-----[ REPLACE ]--------------------------------------------- 
#
function addEntry($ipaddr,$name,$from,$email,$url,$comments,$isprivate="0") {
# 
#-----[ FIND ]------------------------------------------------ 
# 
$addline = "$name$delimiter$from$delimiter$email$delimiter$url$delimiter$comments$delimiter$added$delimiter$isprivate$settings[newline]";
# 
#-----[ REPLACE ]--------------------------------------------- 
#
$addline = "$ipaddr$delimiter$name$delimiter$from$delimiter$email$delimiter$url$delimiter$comments$delimiter$added$delimiter$isprivate$settings[newline]";
# 
#-----[ FIND ]------------------------------------------------ 
# 
Someone has just signed your guestbook!

Name: $name
From: $from
E-mail: $email
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
IP: $ipaddr
# 
#-----[ FIND ]------------------------------------------------ 
# 
<td><b>Your name:</b></td>
<td><input type="text" name="name" size="30" maxlength="30"></td>
# 
#-----[ REPLACE ]--------------------------------------------- 
#
<td><b>Your name:</b></td>
<td><input type="text" name="name" size="30" maxlength="30"><input name="ipaddr" type="hidden" value="<?echo $_SERVER['REMOTE_ADDR']?>" /></td>
# 
#-----[ FIND ]------------------------------------------------ 
# 
function printEntries($lines,$start,$end) {
$start=$start-1;
$end=$end-1;
$delimiter="\t";
for ($i=$start;$i<=$end;$i++) {
list($name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$i]);
# 
#-----[ REPLACE ]--------------------------------------------- 
#
function printEntries($lines,$start,$end) {
$start=$start-1;
$end=$end-1;
$delimiter="\t";
for ($i=$start;$i<=$end;$i++) {
list($ipaddr,$name,$from,$email,$url,$comment,$added,$isprivate)=explode($delimiter,$lines[$i]);
# 
#-----[ FIND ]------------------------------------------------ 
# 
<font class=\"smaller\">E-mail:</font> ";
if (strlen($email)>0) {
echo "<a href=\"mailto:$email\" target=\"_blank\" class=\"smaller\">$email</a>";
# 
#-----[ REPLACE ]--------------------------------------------- 
#
<font class=\"smaller\">E-mail:</font> ";
if (strlen($email)>0) {
echo "<a href=\"mailto:$email\" target=\"_blank\" class=\"smaller\">$email</a><br>IP: $ipaddr";
else { echo "<br>IP: $ipaddr";}
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
#################################################################
#                                                               #
#                         END MODDING                           #
#                                                               #
#################################################################

Basically, this mod will add IP entry into entries.txt called $ipaddr. If you already have entries in your guestbook, this mod would turn your guestbook into a mess eg; "Website" information will be filled with "From", "Email" would be filled with "Website" etc..

So??

There's a little more work to be done.
Grab your entries.txt. The simplest way is to type the URL in your browser like http://www.your-domain.com/path/to/entries.txt, then save it (as .txt) for editing later. Or you can use FTP program. I assume you dont have any trouble finding your own way around.

OK, open up entries.txt in whatever your text editor and add a TAB (\t) for each of newline.
Here are some examples:

original entries

Code: Select all

Name	Location	ema@il.com	http://website.com	comment	August 29, 2005	
Name2	Location2	ema@il2.com	http://website2.com	comment	August 29, 2005	
change to:

Code: Select all

	Name	Location	ema@il.com	http://website.com	comment	August 29, 2005	
	Name2	Location2	ema@il2.com	http://website2.com	comment	August 29, 2005	
Leave the end of file as a single space (one carriage return or \r\n), DO NOT add a tab there.

OK, you're all set.
If you want to customized the layout (a little skill in HTML and PHP is a mandatory), just put $ipaddr anywhere you want under function printEntries($lines,$start,$end) { and function showPrivate($pass,$num){. Or you can just simply replace them with an image and leave the data saved in your entries for respecting privacy of your posters. ;)
Hope this helps.
Post Reply