http://devscorner.xyz/uploads/post-38138-0-18445700-1355145413.pnghi, here an alternative way of coding this, for both BROWSER & OS, just use array, its more clean ;) :
run this sql :
ALTER TABLE `users` ADD `browser` varchar(20) NOT NULL;
ALTER TABLE `users` ADD `os` varchar(30) NOT NULL;
in functions.php put this WHERE is the previous code, ... lol :
EDIT !!! => replace exactly this code
:) :
:) :
Then, you just have to define the width and height to suits your desire, in my example i put 40 x 40 as you can see,
And google images thoses icons you need and put theme into the corresponding folders :
/images/browsers & /images/oss/
i give you those folders along with 1 pic in each to help you start on this :)
So THIS WAY you really dont need to run another sql request, neither another table in databse, alwasys think about saving your server ressources ...
-------
update your langages files. :)
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6351"]browsers.rar[/url]
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6352"]oss.rar[/url]
run this sql :
ALTER TABLE `users` ADD `browser` varchar(20) NOT NULL;
ALTER TABLE `users` ADD `os` varchar(30) NOT NULL;
in functions.php put this WHERE is the previous code, ... lol :
EDIT !!! => replace exactly this code
:) :
:) :
if(preg_match("/Opera/u", getenv("HTTP_USER_AGENT"))) $browser = "opera";
else if(preg_match("/Safari/u", getenv("HTTP_USER_AGENT"))) $browser = "safari";
else if(preg_match("/WebTV/u", getenv("HTTP_USER_AGENT"))) $browser = "webtv";
else if(preg_match("/Maxthon/u", getenv("HTTP_USER_AGENT"))) $browser = "maxthon";
else if(preg_match("/Konqueror/u", getenv("HTTP_USER_AGENT"))) $browser = "Konqueror";
else if(preg_match("/Firefox/u", getenv("HTTP_USER_AGENT"))) $browser = "firefox";
else if(preg_match("/MSIE/u", getenv("HTTP_USER_AGENT"))) $browser = "Internet Explorer";
else if(preg_match("/Lynx/u", getenv("HTTP_USER_AGENT"))) $browser = "lynx";
else if((preg_match("/Nav/u", getenv("HTTP_USER_AGENT"))) || (preg_match("/Gold/u", getenv("HTTP_USER_AGENT"))) || (preg_match("/X11/u", getenv("HTTP_USER_AGENT"))) || (preg_match("/Mozilla/u", getenv("HTTP_USER_AGENT"))) || (preg_match("/Netscape/u", getenv("HTTP_USER_AGENT"))) ) $browser = "mozilla";
else $browser = "Autre - Inconnu";
SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip).", browser=".sqlesc($browser).", page=".sqlesc($where)." WHERE id=" . $row["id"]);
by this one :
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// browser detection
$browser = "Unknown Browser";
$browser_array = array(
'/msie/i' => 'Internet Explorer',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/opera/i' => 'Opera',
'/netscape/i' => 'Netscape',
'/maxthon/i' => 'Maxthon',
'/konqueror/i' => 'Konqueror',
'/mobile/i' => 'Handheld Browser'
);
foreach ($browser_array as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$browser = $value;
}
}
// OS detection
$os = "Unknown OS Platform";
$os_array = array(
'/windows nt 6.2/i' => 'Windows 8',
'/windows nt 6.1/i' => 'Windows 7',
'/windows nt 6.0/i' => 'Windows Vista',
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
'/windows nt 5.1/i' => 'Windows XP',
'/windows xp/i' => 'Windows XP',
'/windows nt 5.0/i' => 'Windows 2000',
'/windows me/i' => 'Windows ME',
'/win98/i' => 'Windows 98',
'/win95/i' => 'Windows 95',
'/win16/i' => 'Windows 3.11',
'/macintosh|mac os x/i' => 'Mac OS X',
'/mac_powerpc/i' => 'Mac OS 9',
'/linux/i' => 'Linux',
'/ubuntu/i' => 'Ubuntu',
'/iphone/i' => 'iPhone',
'/ipod/i' => 'iPod',
'/ipad/i' => 'iPad',
'/android/i' => 'Android',
'/blackberry/i' => 'BlackBerry',
'/webos/i' => 'Mobile'
);
foreach ($os_array as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$os = $value;
}
}
SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip).", browser=".sqlesc($browser).", os=".sqlesc($os).", page=".sqlesc($where)." WHERE id=" . $row["id"]);
then in account.php :
place where you want to show those up :
<?php print("<b>".T_("BROWSER").":</b> " . $CURUSER["browser"] . "n"); ?><br />
<?php print("<b>".T_("OS").":</b> " . $CURUSER["os"] . "n"); ?><br />
EDIT ==> OR if you want to add some icons use this way ( lol coz u'r addicted to pictures ...
<?php echo T_("BROWSER"); ?>: <?php echo $CURUSER["browser"]." <img src='".$site_config['SITEURL']."/images/browsers/".$CURUSER["browser"].".png' width='40' height='40' alt='".$CURUSER["browser"]."' title='Detected Browser : ".$CURUSER["browser"]."'> ";?><br />
<?php echo T_("OS"); ?>: <?php echo $CURUSER["os"]." <img src='".$site_config['SITEURL']."/images/oss/".$CURUSER["os"].".png' width='40' height='40' alt='".$CURUSER["os"]."' title='Detected Operating System : ".$CURUSER["os"]."'> ";?><br />
and in account-details.php,
place where you want to show those up :
<?php echo T_("BROWSER"); ?>: <?php echo htmlspecialchars($user["browser"]);?><br />
<?php echo T_("OS"); ?>: <?php echo htmlspecialchars($user["os"]);?><br />
EDIT ==> OR if you want to add some icons use this way ( lol coz u'r addicted to pictures ...
<?php echo T_("BROWSER"); ?>: <?php echo htmlspecialchars($user["browser"])." <img src='".$site_config['SITEURL']."/images/browsers/".$user["browser"].".png' width='40' height='40' alt='".$user["browser"]."' title='Detected Browser : ".$user["browser"]."'> ";?><br />
<?php echo T_("OS"); ?>: <?php echo htmlspecialchars($user["os"])." <img src='".$site_config['SITEURL']."/images/oss/".$user["os"].".png' width='40' height='40' alt='".$user["os"]."' title='Detected Operating System : ".$user["os"]."'> ";?><br />
Then, you just have to define the width and height to suits your desire, in my example i put 40 x 40 as you can see,
And google images thoses icons you need and put theme into the corresponding folders :
/images/browsers & /images/oss/
i give you those folders along with 1 pic in each to help you start on this :)
So THIS WAY you really dont need to run another sql request, neither another table in databse, alwasys think about saving your server ressources ...
-------
update your langages files. :)
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6351"]browsers.rar[/url]
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6352"]oss.rar[/url]


