I'm trying to create a block of PHP code within HTML such that when the user loads the page, it displays their IP address and time/date as the user in an email address.
I'm using apache on fedora21, and have enabled PHP (tested with phpinfo() function in the same HTML file).
Here is the code I'm trying to execute:
<? echo '<a href="mailto:'.$REMOTE_ADDR.'_'.date('y-m-j').'-@example.com" title="There is no spoon">For stupid spambots'; ?>
It just prints For stupid spambots'; ?>
without printing the generated email address.
<? echo '<a href="mailto:'.$_SERVER['REMOTE_ADDR'].'_'.date('y-m-j').'-@example.com" title="There is no spoon">For stupid spambots</a>'; ?>
Need to close <a href
at first, and if you want to return IP its $_SERVER['REMOTE_ADDR']
not $REMOTE_ADDR
except you define that variable before.