• Welcome to Simple Machines Community Forum. Please login or sign up.
October 15, 2021, 04:00:34 PM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


Full Featured Computer Info

Started by PLAYBOY, July 15, 2011, 10:48:17 PM

Previous topic - Next topic

PLAYBOY

Below is the script to get all computer and connection info of the user.

<script type="text/javascript">
/*
Script Name: Your Computer Information
Author: Harald Hope, Website: http://TechPatterns.com/
Script Source URI: http://TechPatterns.com/downloads/browser_detection.php
Version: 1.2.4
Copyright (C) 3 April 2010

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Get the full text of the GPL here: http://www.gnu.org/licenses/gpl.txt

This script requires the Full Featured Browser Detection and the Javascript Cookies scripts
to function.
You can download them here.
http://TechPatterns.com/downloads/browser_detection_php_ar.txt
http://TechPatterns.com/downloads/javascript_cookies.txt

Please note: this version requires the php browser_detection script version 5.3.3 or
newer, because of the new full return of arrays $moz_array and $webkit_array as keys
10 and 11, and $webkit_array key 7, and use of the new array key 14, true_msie_version.
*/

/*
If your page is XHMTL 1 strict, you have to
put this code into a js library file or your
page will not validate
*/
function client_data(info)
{
if (info == 'width')
{
width_height_html = '<h4  class="right-bar">Current Screen Resolution</h4>';
width = (screen.width) ? screen.width:'';
height = (screen.height) ? screen.height:'';
// check for windows off standard dpi screen res
if (typeof(screen.deviceXDPI) == 'number') {
width *= screen.deviceXDPI/screen.logicalXDPI;
height *= screen.deviceYDPI/screen.logicalYDPI;
}
width_height_html += '<p class="right-bar">' + width + " x " +
height + " pixels</p>";
(width && height) ? document.write(width_height_html):'';
}
else if (info == 'js' )
{
document.write('<p class="right-bar">JavaScript is enabled.</p>');
}
else if ( info == 'cookies' )
{
expires ='';
Set_Cookie( 'cookie_test', 'it_worked' , expires, '', '', '' );
string = '<h4  class="right-bar">Cookies</h4><p class="right-bar">';
if ( Get_Cookie( 'cookie_test' ) )
{
string += 'Cookies are enabled</p>';
}
else {
string += 'Cookies are disabled</p>';
}
document.write( string );
}
}
</script>

<div class="float-left-01">
<h3 class="h-right-bar">Your Computer</h3>
<?php
$os '';
$os_starter '<h4 class="right-bar">Operating System:</h4><p class="right-bar">';
$os_finish '</p>';
$full '';
$handheld '';

// change this to match your include path/and file name you give the script
include('browser_detection.php');
$browser_info browser_detection('full');

// $mobile_device, $mobile_browser, $mobile_browser_number, $mobile_os, $mobile_os_number, $mobile_server, $mobile_server_number
if ( $browser_info[8] == 'mobile' )
{
$handheld '<h4 class="right-bar">Handheld Device:</h4><p class="right-bar">';
if ( $browser_info[13][0] )
{
$handheld .= 'Type: ' ucwords$browser_info[13][0] );
if ( $browser_info[13][7] )
{
$handheld $handheld  ' v: ' $browser_info[13][7];
}
$handheld $handheld  '<br />';
}
if ( $browser_info[13][3] )
{
// detection is actually for cpu os here, so need to make it show what is expected
if ( $browser_info[13][3] == 'cpu os' )
{
$browser_info[13][3] = 'ipad os';
}
$handheld .= 'OS: ' ucwords$browser_info[13][3] ) . ' ' .  $browser_info[13][4] . '<br />';
// don't write out the OS part for regular detection if it's null
if ( !$browser_info[5] )
{
$os_starter '';
$os_finish '';
}
}
// let people know OS couldn't be figured out
if ( !$browser_info[5] && $os_starter )
{
$os_starter .= 'OS: N/A';
}
if ( $browser_info[13][1] )
{
$handheld .= 'Browser: ' ucwords$browser_info[13][1] ) . ' ' .  $browser_info[13][2] . '<br />';
}
if ( $browser_info[13][5] )
{
$handheld .= 'Server: ' ucwords$browser_info[13][5] . ' ' .  $browser_info[13][6] ) . '<br />';
}
$handheld .= '</p>';
}

switch ($browser_info[5])
{
case 'win':
$os .= 'Windows ';
break;
case 'nt':
$os .= 'Windows<br />NT ';
break;
case 'lin':
$os .= 'Linux<br /> ';
break;
case 'mac':
$os .= 'Mac ';
break;
case 'iphone':
$os .= 'Mac ';
break;
case 'unix':
$os .= 'Unix<br />Version: ';
break;
default:
$os .= $browser_info[5];
}

if ( $browser_info[5] == 'nt' )
{
if ($browser_info[6] == 5)
{
$os .= '5.0 (Windows 2000)';
}
elseif ($browser_info[6] == 5.1)
{
$os .= '5.1 (Windows XP)';
}
elseif ($browser_info[6] == 5.2)
{
$os .= '5.2 (Windows XP x64 Edition or Windows Server 2003)';
}
elseif ($browser_info[6] == 6.0)
{
$os .= '6.0 (Windows Vista)';
}
elseif ($browser_info[6] == 6.1)
            {
               
$os .= '6.1 (Windows 7)';
            }
            elseif (
$browser_info[6] == 'ce')
            {
               
$os .= 'CE';
            }
}
elseif ( $browser_info[5] == 'iphone' )
{
$os .=  'OS X (iPhone)';
}
// note: browser detection now returns os x version number if available, 10 or 10.4.3 style
elseif ( ( $browser_info[5] == 'mac' ) && ( strstr$browser_info[6], '10' ) ) )
{
$os .=  'OS X v: ' $browser_info[6];
}
elseif ( $browser_info[5] == 'lin' )
{
$os .= ( $browser_info[6] != '' ) ? 'Distro: ' ucwords($browser_info[6] ) : 'Smart Move!!!';
}
// default case for cases where version number exists
elseif ( $browser_info[5] && $browser_info[6] )
{
$os .=  " " ucwords$browser_info[6] );
}
elseif ( $browser_info[5] && $browser_info[6] == '' )
{
$os .=  ' (version unknown)';
}
elseif ( $browser_info[5] )
{
$os .=  ucwords$browser_info[5] );
}
$os $os_starter $os $os_finish;
$full .= $handheld $os '<h4 class="right-bar">Current Browser / UA:</h4><p class="right-bar">';
if ($browser_info[0] == 'moz' )
{
$a_temp $browser_info[10];// use the moz array
$full .= ($a_temp[0] != 'mozilla') ? 'Mozilla/ ' ucwords($a_temp[0]) . ' ' ucwords($a_temp[0]) . ' ';
$full .= $a_temp[1] . '<br />';
$full .= 'ProductSub: ';
$full .= ( $a_temp[4] != '' ) ? $a_temp[4] . '<br />' 'Not Available<br />';
$full .= ($a_temp[0] != 'galeon') ? 'Engine: Gecko RV: ' $a_temp[3] : '';
}
elseif ($browser_info[0] == 'ns' )
{
$full .= 'Browser: Netscape<br />';
$full .= 'Full Version Info: ' $browser_info[1];
}
elseif ( $browser_info[0] == 'webkit' )
{
$a_temp $browser_info[11];// use the webkit array
$full .= 'User Agent: ';
$full .= ucwords($a_temp[0]) . ' ' $a_temp[1];
$full .= '<br />Engine: AppleWebKit v: ';
$full .= ( $browser_info[1] ) ? $browser_info[1] : 'Not Available';
}
elseif ( $browser_info[0] == 'ie' )
{
$full .= 'User Agent: ';
$full .= strtoupper($browser_info[7]);
// $browser_info[14] will only be set if $browser_info[1] is also set
if ( array_key_exists'14'$browser_info ) && $browser_info[14] )
{
$full .= '<br />(compatibility mode)';
$full .= '<br />Actual Version: ' number_format$browser_info[14], '1''.''' );
$full .= '<br />Compatibility Version: ' $browser_info[1];
}
else
{
$full .= '<br />Full Version Info: ';
$full .= ( $browser_info[1] ) ? $browser_info[1] : 'Not Available';
}
}
else
{
$full .= 'User Agent: ';
$full .= ucwords($browser_info[7]);
$full .= '<br />Full Version Info: ';
$full .= ( $browser_info[1] ) ? $browser_info[1] : 'Not Available';
}
echo $full '</p>';
?>

<script type="text/javascript">
client_data('width');
</script>
<h4 class="right-bar">JavaScript</h4>
<script type="text/javascript">
client_data('js');
</script>
<noscript>
<p class="right-bar">JavaScript is disabled</p>
</noscript>
<script type="text/javascript">
client_data('cookies');
</script>
</div>


Does anybody think this can be turned into a mod? It would be nice and very useful to know the computer info of the members.
Example of the result can be seen in this adress.
http://techpatterns.com/downloads/php_browser_detection.php

live627


PLAYBOY

Yeah but i want information to be stored like ip adresses. And only the admins should see it.
So i can make deeper investigations about members/spammers with dynamic ip adresses. It would be easier to spot them.


PLAYBOY

Very nice. Something like this will be very useful. But i need lot more info than that.
As you see on
http://techpatterns.com/downloads/php_browser_detection.php

Look at "Your Computer" section on the left. Something like this would be so helpful to find same people with multiple memberships.

Advertisement: