Page 2 of 2

Re: Showing IP Address of the visitor

Posted: Tue Jul 12, 2011 11:30 pm
by jacek
An iframe is not the best solution at all.

$_SERVER['REMOTE_ADDR'] is the same as any other variable, so you can use it in an INSERT query to store the IP of the user writing the post, or use it somewhere on the page to display the IP of the user browsing the page.

The reason your eval method did not work was that you (apparently) stored the eval() call in the database too, when you were meant to use eval() on the value that was already stored in the database.
Kamal wrote:Well what I would do is instead of the PHP in there, I put ##IP## or something like that, then do:
$post_body = str_replace('##IP##', $_SERVER['REMOTE_ADDR'], $post_body);
Then the IP will be in place of ##IP##
If you have to store the full page in the table, then this would be the best solution.

Re: Showing IP Address of the visitor

Posted: Fri Jul 15, 2011 9:52 am
by Kamal
jacek wrote:If you have to store the full page in the table.
I think that's what he did