Skip to content

Commit

Permalink
Merge pull request #4 from rhowinespinoza/security_vulnerabilities_fix
Browse files Browse the repository at this point in the history
Security vulnerabilities fix
  • Loading branch information
NielsLeenheer authored Apr 12, 2022
2 parents e20c2c2 + d8976d2 commit b7b2bb8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@
$local = true;
}
else {
$base = preg_replace('/index.php.*/', '', $_SERVER['REQUEST_URI']);
$raw_base = explode('?', $_SERVER['REQUEST_URI']);
$base = preg_replace('/index.php.*/', '', $raw_base[0]);

$result = file_get_contents(($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $base . 'detect.php');
$result = file_get_contents(($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $base . 'detect.php');
if ($result) $working = preg_match('/WhichBrowser/', $result);

$result = file_get_contents(($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $base . 'detect.js');
$result = file_get_contents(($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $base . 'detect.js');
if ($result) $redirect = preg_match('/WhichBrowser/', $result);
}
?>
Expand All @@ -144,14 +145,14 @@
e|=(e&16&&({}.toString).toString().indexOf("\n")===-1)?32:0;p.push('e='+e);f|='sandbox' in d.createElement('iframe')?1:0;f|='WebSocket' in w?2:0;
f|=w.Worker?4:0;f|=w.applicationCache?8:0;f|=w.history && history.pushState?16:0;f|=d.documentElement.webkitRequestFullScreen?32:0;f|='FileReader' in w?64:0;
p.push('f='+f);p.push('r='+Math.random().toString(36).substring(7));p.push('w='+screen.width);p.push('h='+screen.height);var s=d.createElement('script');
s.src='//<?php echo $_SERVER['HTTP_HOST'];?><?php echo $local ? '' : '/whichbrowser'; ?>/detect.<?php echo $redirect ? 'js' : 'php'; ?>?' + p.join('&');d.getElementsByTagName('head')[0].appendChild(s);})();
s.src='//<?php echo $_SERVER['SERVER_NAME'];?><?php echo $local ? '' : '/whichbrowser'; ?>/detect.<?php echo $redirect ? 'js' : 'php'; ?>?' + p.join('&');d.getElementsByTagName('head')[0].appendChild(s);})();
&lt;/script&gt;</pre>

<p>
After the script has been loaded, you need to create a new WhichBrowser object, which you can query for details about the browser that is currently being used:
</p>

<div id='example'></pre>
<div id='example'></div>

<script>

Expand Down

0 comments on commit b7b2bb8

Please # to comment.