Re: Showing IP Address of the visitor
Posted: Tue Jul 12, 2011 11:30 pm
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.
$_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.
If you have to store the full page in the table, then this would be the best solution.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##