Raised This Month: $ Target: $400
 0% 

Determine a Client's Flash Player version


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-19-2013 , 17:41   Determine a Client's Flash Player version
Reply With Quote #1

Determine a Client's Flash Player version

This is a little bit of a hugh workaround for determining if a client has adobe's flashplayer installed and what exact version.

It works by starting a serversocket on the server listening for client connections. To determine the flash version, the client is send to a html page, which uses some javascript to get the flashversion. The client then sends a HTTP request to the server's serversocket with the flashversion as GET parameter. The plugin parses the HTTP request's header to extract the flashversion and calls the callback in the caller's plugin.

If a client fails to do that reverse http call within x seconds, the callback is called with the error boolean set to true. Answers for already disconnected clients are discarded.
So you're guaranteed to get that callback called for connected clients.

Configuration
This plugin requires the Sockets extension!
  • sm_flashversion_timeout - How many seconds to wait for an answer before considering the request as failed? (Default: 5)
  • sm_flashversion_host - Where is the flash detection html script located? (without http:// )
Upload the attached index.html (in flash_html.zip) to your webhost and change the sm_flashversion_host convar to point to that file. Leave out http://.
The plugin tries to bind to a port in the range of (14646, 14686) randomly, so you might check your firewall accordingly.

Native
PHP Code:
/**
 * Called, when the client's flash player version was detected or the detection timed out.
 *
 * @param client        The client that was checked
 * @param flashversion  The flash version of the client like [0]: major, [1]: minor, [2]: release, [3]: build. All 0, if flash is not installed.
 * @param error         True, if the request timed out and the client didn't answer in time. This might happen, if the client has html motds disabled.
 * @param data          Your data, you wanted to pass through
 */
functag public FlashCB(clientflashversion[4], bool:errorany:data);

/**
 * Fetch the client's adobe flash player version.
 * This is done by opening a motd page on the client, which runs some javascript to detect the flash player version.
 *
 * @param client    The client to check
 * @param show      Show the motd panel?
 * @param callback  The callback function to call, when the query finished or timed out
 * @param data      Any data you want to pass to the callback
 * @noreturn
 */
native Flash_GetClientVersion(clientbool:showFlashCB:callbackany:data); 
The attached example provides a simple console command to test your setup.
  • sm_flashversion - Shows a player's flash player version. Usage: sm_flashversion [name|steamid|#userid]


This whole quirk can be used to fetch any information available to the webkit integrated webbrowser in the motd.
Attached Files
File Type: sp Get Plugin or Get Source (flashversion.sp - 120 views - 11.0 KB)
File Type: sp Get Plugin or Get Source (flashversion_example.sp - 112 views - 1.7 KB)
File Type: smx flashversion.smx (9.4 KB, 126 views)
File Type: smx flashversion_example.smx (4.3 KB, 110 views)
File Type: zip flash_html.zip (7.9 KB, 70 views)
File Type: inc flashversion.inc (1.5 KB, 106 views)
__________________

Last edited by Peace-Maker; 06-19-2013 at 17:43. Reason: Missed the .inc
Peace-Maker is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode