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

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
erik

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

Post 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
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

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

Post 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
erik

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

Post by erik »

No problem. The reason for the ip is that i could use it against abuse.
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

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

Post 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
Locked

Return to “Modules/Add-Ons”