php - inserting variable from actionscript into MySQL table -


i using $_server['http_user_agent'] insert browser , os of users upload files website mysql table. using uploadifive, has fallback using flash (uploadify) browsers don't support html5. when using flash, os , browser not returned using $_server['http_user_agent'], instead see "adobe flash player 11".

i can see this tutorial can add actionscript uploadify flash file return browser. externalinterface.call returns same info $_server['http_user_agent'], stored in useragent variable. not sure how integrate insertion mysql database though. need 1 argument inserting field in mysql table.

could this?

thanks,

nick

you can useragent javascript via navigator.useragent

in uploadify there should js similar following:
in example server file uploadify.php, can pass values in other url.

$(function() {     $('#file_upload').uploadify({         'swf'      : 'uploadify.swf',         'uploader' : 'uploadify.php' + '?ua=' + encodeuricomponent(navigator.useragent)     }); }); 

so in uploadify.php can access user agent via

$_get['ua']

now have check input variable assigned:

$useragent = ''; if (isset($_server['http_user_agent'] && false === strstr($_server['http_user_agent'], 'adobe flash player') {     $useragent = $_server['http_user_agent']; } else {     $useragent = $_get['ua']; } 

so can use $useragent in mysql statement.
don´t forget escape mysql_real_escape_string (or use pdo binding):

$useragent = mysql_real_escape_string($useragent); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -