Hi guys,
Currently doing a little project for college where I need to get various pieces of user information (such as Screen resolution, browser type and IP address) and then write this information to a text file. So far I have something that looks like this that has been pieced together from various bits of work
Could somebody tell me where im going wrong and possibly point be in the right direction here?Code:<?php function get_user_browser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $ub=""; if(preg_match('/MSIE/i',$u_agent)) { $ub="ie"; } elseif(preg_match('/firefox/i', $u_agent)) { $ub="firefox"; } elseif(preg_match('/safari/i', $u_agent)) { $ub="safari"; } elseif(preg_match('/opera/i', $u_agent)) { $ub="opera"; } elseif(preg_match('/chrome/i', $u_agent)) { $ub="chrome"; } return $ub; } $myFile="analyse.txt"; $fileHandle= fopen ($myFile, 'a'); $info="$ub, $_COOKIE['height'], $_COOKIE['width']\n"; fwrite($fileHandle, $info); fclose($fileHandle); ?>
Many thanks,
Fortune


LinkBack URL
About LinkBacks
Reply With Quote

