The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Users Environment Variables - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Users Environment Variables (/showthread.php?tid=70) |
Users Environment Variables - antonitus - Mar 17th, 2009 Hi Ben, What code can I use to enable a users environment variables such as operating system, browser version etc. In one of my previous PHP forms I had this piece of code: Quote:<input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT"> But it doesn't seem to work. Any help would be appreciated. Regards, Tony RE: Users Environment Variables - Ben - Mar 17th, 2009 Hey Tony, I actually don't know quite what you mean. Do you mean just grab the user's info for tracking purposes? If so, you'll need to extract it from the PHP $_SERVER variable. Try this. In your web page, add this: PHP Code: <?php print_r($_SERVER); ?> That will output all the values available at your disposal. HTTP_USER_AGENT and REMOTE_HOST are two that are commonly available, so you'd use them like: Code: <input type="hidden" name="env_report" value="<?=$_SERVER["HTTP_USER_AGENT"]?>,<?=$_SERVER["REMOTE_HOST"]?>" /> Hope this helps! RE: Users Environment Variables - antonitus - Mar 18th, 2009 Hi Ben, That's exactly what I want and it worked well. This is useful for technical support issues and it's not for everyone. Thanks, you're a star. Tony |