Page 1 of 1

how can i get ip-address in guestbook (gastbuch)module

Posted: Wed May 25, 2005 1:43 pm
by erik
Hello I'm a real newbe when it comes to php. But maybe theres someone who can help me out. I'd like to be able to get the ip of te person who added an item to the guestbook.
This is what i have so far:

$domain = GetHostByName($REMOTE_ADDR);
This should get the ip but i dont know where to put the line.

in the line:
@mail("$e_mailnoti" , "$e_mailnotibetr", "$e_mailnotimessage:
$_POST[message]
homepage:$_POST[homepage]
ip:$domain
");

Well... I think i'm thinking much too simple with this, but you gotta start somwhere.
Is there's someone who can help me!

Thanks in advance!

Erik

Re: how can i get ip-address in guestbook (gastbuch)module

Posted: Mon Jun 27, 2005 5:51 pm
by kishman155
Hi erik

I am sorry that you are waiting so long vor an reply but no time.

What do you want to do with the ip adress  of the client?

Kris

Re: how can i get ip-address in guestbook (gastbuch)module

Posted: Tue Jun 28, 2005 11:07 pm
by erik
No problem. The reason for the ip is that i could use it against abuse.

Re: how can i get ip-address in guestbook (gastbuch)module

Posted: Fri Jul 01, 2005 11:39 pm
by kishman155
IP adress
Create a new field in the databas
in the code on line 46 maibe
like this

Code: Select all

absenderIP C(255),
gave a new field  a the query on case default
line444

Code: Select all

$query="INSERT INTO ";
$query .= cms_db_prefix()."module_gastbuch";
$query .=" (absender, e_mail, homepage, message, datum) values ('".$_POST[absender]."',  '".$_POST[betreff]."', '".$_POST[homepage]."', '".$_POST[message]."', now())";
replaced with this

Code: Select all

$query="INSERT INTO ";
$query .= cms_db_prefix()."module_gastbuch";
$query .=" (absender, absenderIP,  e_mail, homepage, message, datum) values ('".$_POST[absender]."', '".$_SERVER[REMOTE_ADDR]."',  '".$_POST[betreff]."', '".$_POST[homepage]."', '".$_POST[message]."', now())";
At case defaultadmin after $absender you could write IP-Adress

and after ".$row["absender"]." you write ".$row["absenderIP"]."

hope that work not tested

kris