Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.0 #1

Open
wants to merge 177 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
cc6bd3c
Remove validation test for input type=color
NielsLeenheer Jul 9, 2012
9965a6e
Set style to inline-block for input type=image
NielsLeenheer Jul 9, 2012
87ee80e
Set the number of points of getUserMedia to 10 instead of 20
NielsLeenheer Jul 9, 2012
200ca02
Update version number to 4.0
NielsLeenheer Jul 9, 2012
f496f47
Add new tests for valueAsDate and valueAsNumber
NielsLeenheer Jul 10, 2012
1f7183f
Change mark to test to detect background color other than transparent…
NielsLeenheer Jul 10, 2012
575c5f3
The HTML5 logo was not displayed correctly on devices with a device p…
NielsLeenheer Sep 23, 2012
38be656
Add support for Ogg Opus
NielsLeenheer Sep 23, 2012
7bed9b4
Add support for the download and ping attribute on the a element
NielsLeenheer Sep 23, 2012
7e39d5e
Add showModalDialog
NielsLeenheer Sep 23, 2012
2750c97
Support for Mutation Observer
NielsLeenheer Sep 23, 2012
a1ce7d1
Add support for PointerLock
NielsLeenheer Sep 23, 2012
9709cd1
Add a nota about File API: directories and system being proprietary a…
NielsLeenheer Sep 23, 2012
14d084a
Add iOS < 6 on the blacklist for file input fields
NielsLeenheer Sep 23, 2012
f406771
Set the number of points for drag and drop to 0, to make sure mobile …
NielsLeenheer Sep 23, 2012
5d2acbd
Fix a typo in the requestFullscreen test
NielsLeenheer Sep 23, 2012
48d52b3
Redistribute some of the points to emphasise the more important tests
NielsLeenheer Sep 23, 2012
6df397e
Add support for detection of BlackBerry 10 devices
NielsLeenheer Sep 23, 2012
f2358b4
Add support for Chrome 21
NielsLeenheer Sep 23, 2012
e40cfe4
Add various new devices and models
NielsLeenheer Sep 23, 2012
bc24bbd
Update test version to 4.0
NielsLeenheer Sep 23, 2012
810844d
Update file input black list so that it actually works
NielsLeenheer Sep 23, 2012
fc27938
Remove showModalDialog test because it really sucks and I don't think…
NielsLeenheer Sep 23, 2012
be33656
Redistribute some points
NielsLeenheer Sep 23, 2012
1e455ef
Support detecting AliyunOS
NielsLeenheer Sep 23, 2012
c8f43ad
Support detecting Baidu Browser
NielsLeenheer Sep 23, 2012
5516c82
Many new devices
NielsLeenheer Sep 23, 2012
b50894a
Add more television browsers
NielsLeenheer Sep 24, 2012
5f19e3b
Add detection of older versions of Aliyun OS
NielsLeenheer Sep 24, 2012
0d86a60
Some Archos devices did not specify a correct Android version number,…
NielsLeenheer Sep 24, 2012
6ea0a6f
More Android version detection
NielsLeenheer Sep 24, 2012
ab527ea
Add another way of detecting Baidu Browser
NielsLeenheer Sep 24, 2012
f4496b5
Detect Dorothy browser
NielsLeenheer Sep 24, 2012
2200559
Detect the BlackBerry Android runtime
NielsLeenheer Sep 24, 2012
83dcc68
Add support for detecting MaCross Mobile
NielsLeenheer Sep 24, 2012
574e6c2
More detail for the BlackBerry 10 version number
NielsLeenheer Sep 24, 2012
e6c986b
More Aliyun OS detection
NielsLeenheer Sep 24, 2012
a814293
Add device detection for Aliyun OS
NielsLeenheer Sep 24, 2012
ec895fb
Many new phones and models
NielsLeenheer Sep 24, 2012
03ec31b
Update blacklists, remove Maxthon from most, add Sogou Explorer
NielsLeenheer Sep 25, 2012
3d4e9e8
Add support for Chrome 22
NielsLeenheer Sep 25, 2012
b5664f1
Fix a vendor prefix of webkitMutationObserver and mozMutationObserver
syoichi Sep 29, 2012
b3c0c1a
Merge pull request #207 from syoichi/topic
NielsLeenheer Oct 3, 2012
ad8d7c9
Instead of looking at browsers for the whitelist, look at rendering e…
NielsLeenheer Oct 3, 2012
8b72ac2
Date fields seems to be working on UC Browser 8.6 or higher
NielsLeenheer Oct 3, 2012
20d2a1e
Detect Windows RT
NielsLeenheer Oct 3, 2012
1e25609
Detect Internet Explorer for Xbox
NielsLeenheer Oct 4, 2012
4e178f0
Detect Windows Phone 8 in an emulator
NielsLeenheer Oct 4, 2012
2e63d8b
Remove faulty Windows RT detection
NielsLeenheer Oct 4, 2012
64b78c0
Detect Nintendo Wii U
NielsLeenheer Oct 4, 2012
6afe85e
Improve Dolphin detection
NielsLeenheer Oct 4, 2012
fe33e41
Improve MachBlue XT detection
NielsLeenheer Oct 4, 2012
1b81be0
Improve Midori detection
NielsLeenheer Oct 4, 2012
f7264d6
Add new browsers and phone models
NielsLeenheer Oct 4, 2012
8f3c13e
The wrong blacklist entry was used for fullscreen detection
NielsLeenheer Oct 4, 2012
92901c1
Add a new blacklist for the FileSystem API
NielsLeenheer Oct 4, 2012
0244787
Add BlackBerry to the Full Screen blacklist
NielsLeenheer Oct 4, 2012
df994d3
Remove unneeded comma
NielsLeenheer Oct 5, 2012
8e0ca2b
Only translate when we find querySelectorAll
NielsLeenheer Oct 5, 2012
8dfab1b
Prevent an error in IE6
NielsLeenheer Oct 5, 2012
9fe5210
Fix a rendering problem with rounded corners in Opera
NielsLeenheer Oct 5, 2012
bc0df25
Add support for detecting Nokia Xpress
NielsLeenheer Oct 5, 2012
1725524
A couple of new additions to the model database
NielsLeenheer Oct 5, 2012
d5da714
Add support for full screen graphs usign the non-prefixed API as used…
NielsLeenheer Oct 5, 2012
9ac6f0f
Update date for release of 4.0
NielsLeenheer Oct 15, 2012
2008c9c
Update version number in config file
NielsLeenheer Oct 15, 2012
cf49361
Collect additional useragent headers
NielsLeenheer Oct 15, 2012
7bc17d6
Make a fingerprint based on test results
NielsLeenheer Oct 15, 2012
2187d35
Make sure the points in the header do not mess with the first column …
NielsLeenheer Oct 15, 2012
2f7a76a
Add links to Webplatform.org and MDN
NielsLeenheer Oct 15, 2012
61aa3ad
Many changes to useragent detection
NielsLeenheer Oct 15, 2012
44ca639
Add new tab for the tumblr blog
NielsLeenheer Oct 21, 2012
fc85c0a
Update date and revision for release of 4.0
NielsLeenheer Oct 21, 2012
044a390
Update location of 'updated' banner
NielsLeenheer Oct 21, 2012
1da9604
New css file that contains all the styles for the tumlr blog
NielsLeenheer Oct 21, 2012
81ad983
Add non-prefixed gradients
NielsLeenheer Oct 21, 2012
0390c2c
Update style of 'updated' banner
NielsLeenheer Oct 21, 2012
7ccb636
Share panel disappeared when the window was between 640 and 480 pixel…
NielsLeenheer Oct 21, 2012
b4dac49
Make sure text is not displayed on top of cloudvps logo
NielsLeenheer Oct 21, 2012
d180458
Use a different style of top menu on small devices
NielsLeenheer Oct 21, 2012
25518e0
Update scripts/useragents.js
JohnBear Nov 9, 2012
2479d95
Merge pull request #217 from JohnBear/patch-7
NielsLeenheer Nov 11, 2012
3046bd3
Fix AndroVM detection
NielsLeenheer Nov 11, 2012
157859a
Better cleanup of device names
NielsLeenheer Nov 11, 2012
e8bab30
Many, many new devices
NielsLeenheer Nov 11, 2012
2fabb24
Fix Windows Phone detection
NielsLeenheer Nov 11, 2012
7924ec3
A device with S60 in the model name was misidentified as a Series60 d…
NielsLeenheer Nov 11, 2012
b8c0b98
BREW devices used the wrong database
NielsLeenheer Nov 11, 2012
14c96ce
Add Motorola KreaTV
NielsLeenheer Nov 11, 2012
7b79a6f
One more way device models can be detected for Android
NielsLeenheer Nov 11, 2012
d1ea254
Add Pantech device detection
NielsLeenheer Nov 11, 2012
ad3a642
Fix Touchwiz detection
NielsLeenheer Nov 11, 2012
cac6010
Add Kindle Fire model detection using the Android database
NielsLeenheer Nov 11, 2012
8dcfe37
Add 360 Phone Browser
NielsLeenheer Nov 11, 2012
7072744
Add OneBrowser
NielsLeenheer Nov 11, 2012
b2112fe
Merge branch 'version-4.0' of https://github.com/NielsLeenheer/html5t…
NielsLeenheer Nov 11, 2012
5fc53b2
Small formatting issue
NielsLeenheer Nov 11, 2012
ce9e2a3
Add Doga Rhodonit browser
NielsLeenheer Nov 11, 2012
9bb7a99
Add Hive Explorer browser
NielsLeenheer Nov 11, 2012
d17665e
Add Lumia 820 and 920
NielsLeenheer Nov 11, 2012
d5e9b8f
Add detection of OviBrowser as NokiaBrowser for S40
NielsLeenheer Nov 11, 2012
e45643c
Make sure OviBrowser isn't detected as iBrowser
NielsLeenheer Nov 11, 2012
8df7859
Remove OS name from Nokia Xpress proxy browser, because it can be both
NielsLeenheer Nov 11, 2012
0cb7674
Add Windows Phone 8 models
NielsLeenheer Nov 11, 2012
3c09067
Add a hybrid JavaScript / PHP implementation of the useragent detecti…
NielsLeenheer Jan 25, 2013
d4220bc
Retrieve data from new table structure
NielsLeenheer Apr 3, 2013
63fe8be
Bugfix with unknown data
NielsLeenheer Apr 3, 2013
2bb7040
Forgot to update browser.html with the new UA lib
NielsLeenheer Apr 3, 2013
5c4b834
Remove chromeframe trigger
NielsLeenheer Apr 3, 2013
558e529
Add deviceIdentified info the data
NielsLeenheer Apr 3, 2013
509e97d
Display table after submitting data
NielsLeenheer Apr 3, 2013
b09151d
Change navigation text
NielsLeenheer Apr 3, 2013
54c87ee
Add popup table for extra info about a test
NielsLeenheer Apr 3, 2013
b9b910b
Change the way grades are shown
NielsLeenheer Apr 3, 2013
34aa935
Add text about donating
NielsLeenheer Apr 3, 2013
7dab27d
Change text about donating
NielsLeenheer Apr 3, 2013
2dcdd21
Updated URLs to match new location of certain sections of the HTML5 spec
NielsLeenheer Apr 3, 2013
b482253
Fix a bug in the way background tasks are tracked
NielsLeenheer Apr 3, 2013
858113d
Place the entire tokenizer test in a try {} catch {} block
NielsLeenheer Apr 3, 2013
a04d05d
Catch exceptions from the fillText test
NielsLeenheer Apr 3, 2013
018088b
Catch exceptions from the elements tests
NielsLeenheer Apr 3, 2013
d2dd272
Use a different method of inerating over arrays
NielsLeenheer Apr 3, 2013
df028e0
Whitespace changes
NielsLeenheer Apr 3, 2013
9089af3
Make the URL of loaded resources unique so they never are pulled from…
NielsLeenheer Apr 3, 2013
5d732d3
Update the test for Notifications
NielsLeenheer Apr 3, 2013
2fc5222
Remove newer versions of Mathon from the datafield blacklist
NielsLeenheer Apr 3, 2013
8195191
Revert "Bugfix with unknown data"
NielsLeenheer Apr 3, 2013
b3f6765
Revert "Retrieve data from new table structure"
NielsLeenheer Apr 3, 2013
ff72ee9
Retrieve data from new table structure
NielsLeenheer Apr 3, 2013
339bdff
Use one field for all headers instead of specific fields for a limite…
NielsLeenheer Apr 3, 2013
4b7ed37
Calculate a useragentId based on a delocalized useragent
NielsLeenheer Apr 3, 2013
c36b7dd
Store data in a separate fingerprint table
NielsLeenheer Apr 3, 2013
544e0b0
Escape { and } because it caused problems on S60 WebKit
NielsLeenheer Apr 3, 2013
543db13
Also use revision in version comparisons
NielsLeenheer Apr 3, 2013
f8598da
If we encounter a cloaked UC Browser, reset version
NielsLeenheer Apr 3, 2013
d833a18
If we encounter a cloaked UC Browser that claim to be running on Wind…
NielsLeenheer Apr 3, 2013
25d5c0d
Do not check for features if we are using a proxy browser, because we…
NielsLeenheer Apr 3, 2013
b14e5ff
Whitespace changes
NielsLeenheer Apr 3, 2013
b316143
Add new device types
NielsLeenheer Apr 3, 2013
ca338c7
Analyse browser based on X-Requested-With header
NielsLeenheer Apr 3, 2013
2f8ff03
Many new devices for the device database
NielsLeenheer Apr 3, 2013
3d1b33d
If we detect Puffin using a header, set the browser to Puffin
NielsLeenheer Apr 3, 2013
7838cba
Expand iOS device detection to include models for Puffin
NielsLeenheer Apr 3, 2013
6d1ca20
Also allow WindowsMobile without a space
NielsLeenheer Apr 3, 2013
cfe01ec
Even more devices for the database
NielsLeenheer Apr 3, 2013
7103f41
Clean up the version of certain HP webOS devices
NielsLeenheer Apr 3, 2013
34f17f4
Detect tablets using an case-insensitive string
NielsLeenheer Apr 3, 2013
21efac4
Added MAUI Runtime
NielsLeenheer Apr 3, 2013
ddc9858
Added BeOS
NielsLeenheer Apr 3, 2013
5f99c0a
Added AROS
NielsLeenheer Apr 3, 2013
aacf0f2
Added the Tesla Model S in-car browser
NielsLeenheer Apr 3, 2013
67b6474
Allow U tag in OS/2 ua
NielsLeenheer Apr 3, 2013
8cdcf1e
Give Opera detection a lower priority, because newer versions are bas…
NielsLeenheer Apr 3, 2013
f1efc79
Add Windows "Blue" detection
NielsLeenheer Apr 3, 2013
16d0082
Add limited BB10 model detection
NielsLeenheer Apr 3, 2013
b943d59
Add support for detecting IE11
NielsLeenheer Apr 3, 2013
12b0a34
Add support for detecting the OS/2 port of SeaMonkey
NielsLeenheer Apr 3, 2013
8f72541
Add new versions of Chrome
NielsLeenheer Apr 3, 2013
b8ef820
Add support for detecting Opera 14
NielsLeenheer Apr 3, 2013
6e0b9b0
Some versions of UC Browser were initialially detected as Chrome and …
NielsLeenheer Apr 3, 2013
28143ac
Set the proxy flag for Puffin
NielsLeenheer Apr 3, 2013
a3adf46
Drop the 'channel' for Maxthon
NielsLeenheer Apr 3, 2013
b985d4a
Make the Maxthon version detection 3 digits accurate
NielsLeenheer Apr 3, 2013
16ebf08
Add a lot of browser and bots
NielsLeenheer Apr 3, 2013
f05c0f1
Prevent error when browser name is not set
NielsLeenheer Apr 3, 2013
5fe73e6
Fix a bug in NetCast TV detection
NielsLeenheer Apr 3, 2013
064f8a5
Prevent an error when there is no match
NielsLeenheer Apr 3, 2013
b35af3e
Add support for detecting Netscape Navigator
NielsLeenheer Apr 3, 2013
aed098d
Add support for detecting IRIX
NielsLeenheer Apr 3, 2013
45e051a
Fix typo (thanks leematos)
NielsLeenheer Apr 3, 2013
c8e4b8f
Add default text color
NielsLeenheer Apr 3, 2013
17a61b6
Use proper viewport syntax
NielsLeenheer Apr 3, 2013
98315e6
Add a Windows 8 tile image and color
NielsLeenheer Apr 3, 2013
a82196a
Make tokenizer test compatible with DOM4
NielsLeenheer Apr 3, 2013
001c5e4
Add geolocation blacklist
NielsLeenheer Apr 3, 2013
3a42b17
Add device orientation blacklist
NielsLeenheer Apr 3, 2013
fcfa9e7
Add Baidu Browser to a whole bunch of blacklists… Shame on you!
NielsLeenheer Apr 3, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@
<body>
<div class='header'>
<h1 data-i18n>The HTML5 test <em>&ndash; how well does your browser support HTML5?</em></h1>
<ul>
<li><a href='/index.html' data-i18n>Your browser</a></li>
<li><a href='/results/desktop.html' data-i18n>Other<span> browser</span>s</a></li>
<li><a href='/compare/browser/index.html' data-i18n>Compare</a></li>

<li class='right selected'><a href='/about.html' data-i18n>About<span> the test</span></a></li>
</ul>
<div class='navigation'>
<ul class='left'>
<li><a href='/index.html' data-i18n>Your browser</a></li>
<li><a href='/results/desktop.html' data-i18n>Other<span> browser</span>s</a></li>
<li><a href='/compare/browser/index.html' data-i18n>Compare</a></li>
</ul>
<ul class='right'>
<li><a href='http://blog.html5test.com/' data-i18n>News</a></li>
<li class='selected'><a href='/about.html' data-i18n>About<span> the test</span></a></li>
</ul>
</div>
</div>

<div class='page'>
<div class='page hasNavigation'>
<div class='paper'>
<ul>
<li class='selected'><a href='about.html' data-i18n>Frequently asked questions</a></li>
Expand Down Expand Up @@ -170,7 +174,7 @@ <h3>What happens when a browser cheats?</h3>
<p>
We cannot distinguish between a browser that supports a particular feature and a browser that lies about supporting
that feature. The only way do deal with these situations it to manually confirm the test results. And if a browser
is found to be overly confidant about claiming support for certain features we can put that browser on a blacklist.
is found to be overly confident about claiming support for certain features we can put that browser on a blacklist.
That means that that even though the browser claims to support a particular feature, we ignore what the browser says and do
not give any points. This is usually just a temporary problem and once the browser has been fixed we will remove
the new version from the blacklist.
Expand Down Expand Up @@ -256,7 +260,7 @@ <h3>What kind of data is collected from visitors?</h3>

<div class='copyright'>
<p>Copyright 2010-2012 by Sights</p>
<p>April, 2012 - version 3.0</p>
<p>October, 2012 - version 4.0</p>
<p data-i18n='footer'>
The HTML5 test is being developed at <a href='http://github.com/NielsLeenheer/html5test'>Github</a>. Please file an issue there if you find any bugs or think of any improvements to this test.
Please note that the HTML5 test is not affiliated with the W3C or the HTML5 working group.
Expand Down
121 changes: 74 additions & 47 deletions backend/browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
SELECT
b.unique AS id, b.nickname, b.details, '" . $type . "' AS type
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
FIND_IN_SET('" . $type . "',b.type) AND
s.version = '" . $version . "' AND
s.points != ''
f.points != ''
ORDER BY
id, nickname
");

echo mysql_error();

while ($row = mysql_fetch_object($res)) {
$results[] = $row;
}
Expand All @@ -38,62 +40,87 @@
$show = explode('/', $_REQUEST['show']);

if (isset($show[0])) {
$res = mysql_query("
SELECT
b.unique AS id, b.nickname, s.score, s.bonus, s.points, s.results
FROM
browsers AS b,
scores AS s
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "' AND
b.unique ='" . mysql_real_escape_string($show[0]) . "'
");
if (preg_match("/^[0-9]+\_[a-f0-9]{4,4}$/", $show[0])) {
if ($row = getResultsForUniqueId($show[0])) {
$tpl->set('one', json_encode($row));
}
}

if ($row = mysql_fetch_object($res)) {
$tpl->set('one', json_encode($row));
else {
if ($row = getResultsForBrowser($show[0], $version)) {
$tpl->set('one', json_encode($row));
}
}
}

if (isset($show[1])) {
$res = mysql_query("
SELECT
b.unique AS id, b.nickname, s.score, s.bonus, s.points, s.results
FROM
browsers AS b,
scores AS s
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "' AND
b.unique ='" . mysql_real_escape_string($show[1]) . "'
");
if (preg_match("/^[0-9]+\_[a-f0-9]{4,4}$/", $show[1])) {
if ($row = getResultsForUniqueId($show[1])) {
$tpl->set('two', json_encode($row));
}
}

if ($row = mysql_fetch_object($res)) {
$tpl->set('two', json_encode($row));
else {
if ($row = getResultsForBrowser($show[1], $version)) {
$tpl->set('two', json_encode($row));
}
}
}

if (isset($show[2])) {
$res = mysql_query("
SELECT
b.unique AS id, b.nickname, s.score, s.bonus, s.points, s.results
FROM
browsers AS b,
scores AS s
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "' AND
b.unique ='" . mysql_real_escape_string($show[2]) . "'
");
if (preg_match("/^[0-9]+\_[a-f0-9]{4,4}$/", $show[2])) {
if ($row = getResultsForUniqueId($show[2])) {
$tpl->set('three', json_encode($row));
}
}

if ($row = mysql_fetch_object($res)) {
$tpl->set('three', json_encode($row));
else {
if ($row = getResultsForBrowser($show[2], $version)) {
$tpl->set('three', json_encode($row));
}
}
}
}


echo $tpl->fetch();
echo $tpl->fetch();


function getResultsForBrowser($browser, $version) {
$res = mysql_query("
SELECT
b.unique AS id, b.nickname, f.score, f.bonus, f.points, f.results
FROM
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.listed = 1 AND
s.version = '" . $version . "' AND
b.unique ='" . mysql_real_escape_string($browser) . "'
");

if ($row = mysql_fetch_object($res)) {
return $row;
}
}



function getResultsForUniqueId($id) {
$res = mysql_query("
SELECT
r.uniqueid AS id, 'Unique id' AS nickname, r.score, r.bonus, r.points, r.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight
FROM
results AS r
WHERE
r.uniqueid ='" . mysql_real_escape_string($id) . "'
");

if ($row = mysql_fetch_object($res)) {
return $row;
}
}



2 changes: 1 addition & 1 deletion backend/config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$version = '3.00';
$readonly = false;
$version = '4.00';

$mysql['server'] = 'localhost';
$mysql['username'] = '*****';
Expand Down
37 changes: 20 additions & 17 deletions backend/feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
SELECT
b.unique AS id, CONCAT(b.unique,'-" . $type . "-',b.id) AS uid, b.nickname, b.details, '" . $type . "' AS type
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
FIND_IN_SET('" . $type . "',b.type) AND
s.version = '" . $version . "' AND
s.points != ''
f.version = '" . $version . "' AND
f.points != ''
ORDER BY
id, nickname
");

echo mysql_error();


while ($row = mysql_fetch_object($res)) {
$results[] = $row;
}
Expand All @@ -42,12 +45,12 @@

$res = mysql_query("
SELECT
IF(s.results LIKE '%" . mysql_real_escape_string($show[0]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
IF(f.results LIKE '%" . mysql_real_escape_string($show[0]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "'
");
Expand All @@ -67,12 +70,12 @@

$res = mysql_query("
SELECT
IF(s.results LIKE '%" . mysql_real_escape_string($show[1]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
IF(f.results LIKE '%" . mysql_real_escape_string($show[1]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "'
");
Expand All @@ -92,12 +95,12 @@

$res = mysql_query("
SELECT
IF(s.results LIKE '%" . mysql_real_escape_string($show[2]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
IF(f.results LIKE '%" . mysql_real_escape_string($show[2]) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "'
");
Expand Down
58 changes: 44 additions & 14 deletions backend/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

$res = mysql_query("
SELECT
IF(s.results LIKE '%" . mysql_real_escape_string($_REQUEST['id']) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
IF(f.results LIKE '%" . mysql_real_escape_string($_REQUEST['id']) . "=1%',1,0) AS supported, b.unique AS id, CONCAT(b.unique,'-',b.id) AS uid
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "'
");
Expand All @@ -48,7 +48,7 @@
if (substr($_REQUEST['id'], 0, 7) == 'custom:') {
$res = mysql_query("
SELECT
'custom' AS id, 'Unique id' AS nickname, score, bonus, points, results
uniqueid AS id, 'Unique id' AS nickname, score, bonus, points, results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight
FROM
results
WHERE
Expand All @@ -57,12 +57,12 @@
} else {
$res = mysql_query("
SELECT
b.unique AS id, b.nickname, s.score, s.bonus, s.points, s.results
b.unique AS id, b.nickname, f.score, f.bonus, f.points, f.results
FROM
browsers AS b,
scores AS s
browsers AS b
LEFT JOIN scores AS s ON (b.unique = s.id)
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
WHERE
b.unique = s.id AND
b.listed = 1 AND
s.version = '" . $version . "' AND
b.unique ='" . mysql_real_escape_string($_REQUEST['id']) . "'
Expand All @@ -79,10 +79,26 @@
$payload = json_decode($_REQUEST['payload']);
$headers = apache_request_headers();

$xWapProfile = isset($headers['x-wap-profile']) ? $headers['x-wap-profile'] : '';
$xOperaMiniPhoneUA = isset($headers['X-OperaMini-Phone-UA']) ? $headers['X-OperaMini-Phone-UA'] : '';
$filteredHeaders = '';

foreach($headers as $key => $value) {
if (!in_array(strtolower($key), array(
'accept', 'host', 'connection', 'dnt', 'user-agent', 'accept-encoding', 'accept-language',
'accept-charset', 'referer', 'cookie', 'content-type', 'content-length', 'content-transfer-encoding',
'origin', 'pragma', 'cache-control', 'via', 'clientip', 'x-bluecoat-via', 'x-piper-id',
'x-forwarded-for', 'x-teacup', 'x-saucer', 'isajaxrequest', 'keep-alive', 'max-forwards',
'xroxy-connection', 'client-ip', 'cookie2', 'x-via', 'x-imforwards', 'http-client-id',
'x-proxy-id', 'z-forwarded-for', 'expect', 'x-ip-address', 'x-rbt-optimized-by', 'qpr-loop',
'cuda_cliip', 'x-source-id', 'x-clickoncesupport'
))) {
$filteredHeaders .= $key . ": " . $value . "\n";
}
}

if (!$readonly && intval($payload->version) >= 4) {
$useragentHeader = $_SERVER['HTTP_USER_AGENT'];
$useragentId = preg_replace("/(; ?)[a-z][a-z](?:-[a-zA-Z][a-zA-Z])?([;)])/", '$1xx$2', $useragentHeader);

if (!$readonly) {
mysql_query('
INSERT INTO
results
Expand Down Expand Up @@ -113,13 +129,27 @@
deviceHeight = "' . mysql_real_escape_string($payload->deviceHeight) . '",
deviceType = "' . mysql_real_escape_string($payload->deviceType) . '",
useragent = "' . mysql_real_escape_string($payload->useragent) . '",
useragentHeader = "' . mysql_real_escape_string($useragentHeader) . '",
useragentId = "' . mysql_real_escape_string(md5($useragentId)) . '",
humanReadable = "' . mysql_real_escape_string($payload->humanReadable) . '",
xWapProfile = "' . mysql_real_escape_string($xWapProfile) . '",
xOperaMiniPhoneUA = "' . mysql_real_escape_string($xOperaMiniPhoneUA) . '",
headers = "' . mysql_real_escape_string($filteredHeaders) . '",
results = "' . mysql_real_escape_string($payload->results) . '",
points = "' . mysql_real_escape_string($payload->points) . '",
fingerprint = "' . mysql_real_escape_string(md5($payload->results.$payload->points)) . '",
status = 0
');

mysql_query('
INSERT INTO
fingerprints
SET
fingerprint = "' . mysql_real_escape_string(md5($payload->results.$payload->points)) . '",
version = "' . mysql_real_escape_string($payload->version) . '",
score = "' . mysql_real_escape_string($payload->score) . '",
bonus = "' . mysql_real_escape_string($payload->bonus) . '",
results = "' . mysql_real_escape_string($payload->results) . '",
points = "' . mysql_real_escape_string($payload->points) . '"
');
}

break;
Expand Down
Loading