Have just upgraded to v1.5 mainly for the IP functionality due to consistent abuse of guestbook by one person. I delete malicious messages once they are posted but I need to try and keep a record of them hence I would like to include the IP address (and post time if possible) in the email notification.
What variable is used to store the IP address and can I reference it in the notification email? I have noticed $IP being used quite a lot but I have tried to include that in the email but it comes out blank - could I just use $REMOTE ADDR or is there a variable I can use already defined?
Also where can I change the date format to allow me to capture the time as well as date?
Many thanks
Jase
How do I include IP address in notification email?
PHP Stores IP in the variable.
If used inside quotes (like it the $message variable in GBook) you need to use it without the single quotes:
By the way, you can select IP to be banned when deleting a message or viewing IP from GBook.
Code: Select all
$_SERVER['REMOTE_ADDR']
If used inside quotes (like it the $message variable in GBook) you need to use it without the single quotes:
Code: Select all
$_SERVER[REMOTE_ADDR]
By the way, you can select IP to be banned when deleting a message or viewing IP from GBook.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Thanks Klemen - I had already used remote_addr but liked the way the GB script resolved the IP to a domaim which is why I wanted to use the variable already set but only because Im lazy!Klemen Stirn wrote:PHP Stores IP in thevariable.Code: Select all
$_SERVER['REMOTE_ADDR']
If used inside quotes (like it the $message variable in GBook) you need to use it without the single quotes:Code: Select all
$_SERVER[REMOTE_ADDR]
By the way, you can select IP to be banned when deleting a message or viewing IP from GBook.
Thanks for a great script

Jase
You can use PHP function gethostbyaddr() to get the resolving host (domain/ISP).
http://www.php.net/gethostbyaddr
http://www.php.net/gethostbyaddr
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Ok, have done it and here the code for 1.5:
1) find line 739 reading:
$email=str_replace($repl,$char,$email);
2) add on line 740 (insert blank line):
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
3) on line 747 add (under From:):
Sender: $hostname
thats all! - save the script, upload it and here ya go...
1) find line 739 reading:
$email=str_replace($repl,$char,$email);
2) add on line 740 (insert blank line):
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
3) on line 747 add (under From:):
Sender: $hostname
thats all! - save the script, upload it and here ya go...