previous-domain-name.com" and.? php question: How to display "your ip-address is X.X.X.X you came to this page from previous-domain-name.com"?

$your_ip_address=?????;
$last_web_page=????; //the whole page address (the first 256 symbols), but not just domain name is OK as well.
$your_screen_resolution_height=???;
$your_screen_resolution_widht=???;

Thank you.