Jump to content


Popular Content

Showing content with the highest reputation on 05/15/2018 in all areas

  1. 1 point
    The user's IP is in $_SERVER['REMOTE_ADDR']. This does not involve DNS lookup though, getting the visitor's IP does not involve translating a domain name to an IP. That's what DNS does.
  2. 1 point
    It looks like you're trying to use Javascript to run a PHP function, that's not how it works. Javascript and PHP are not connected like that. If you check your browser's error console, you'll probably see an error message that says something like CreateDownloadFile is undefined or not a function, that's because it's not a Javascript function. One option is to create a hidden iframe on the page, and use Javascript to set the src of that iframe to a PHP file that will generate the file, and you pass whatever data you need so that PHP creates the correct file. You can pass that data in the URL when you set the src of the iframe. If PHP responds with the correct download headers, then the user will just see a file open/save dialog box pop up that will let them open or save the file.