Skip to content

Instantly share code, notes, and snippets.

@Freeaqingme
Last active December 17, 2015 18:29
Show Gist options
  • Save Freeaqingme/5653829 to your computer and use it in GitHub Desktop.
Save Freeaqingme/5653829 to your computer and use it in GitHub Desktop.
Cross browser test stuff
<?php
switch ($_SERVER['HTTP_HOST']) {
case 'aa.nl':
case 'www.aa.nl':
case 'mijn.aa.nl':
if (count($_COOKIE) >0 ) {
echo 'In the past 5 minutes a cookie was set:';
echo '<pre>' . print_r($_COOKIE,1) . '</pre>';
} else {
setcookie('aa_nl', 'Cookie set by aa.nl on .aa.nl on ' . time(), time()+300, '/', '.aa.nl');
setcookie('aa_nl2', 'Cookie set by aa.nl on aa.nl on ' . time(), time()+300, '/', 'aa.nl');
// setcookie('aa_nl2', 'Cookie set by aa.nl on aa.nl on ' . time(), time()+300, '/');
echo 'no cookie was set. I just set cookie aa_nl and aa_nl2';
}
break;
case 'toegang.aa.nl':
echo '<html><head>
<script language="javascript" type="text/javascript">
function foo($string) {
alert($string);
}
</script>
<!--<script language="javascript" type="text/javascript" src="http://idm.bb.nl/?rand='.rand().'"></script> -->
<script language="javascript" type="text/javascript" src="http://idm.aa.nl/?rand='.rand().'"></script>
<script language="javascript" type="text/javascript" src="http://idm.bb.nl/?rand='.rand().'"></script>
</head><body>IDM</body></html>
';
break;
case 'idm.bb.nl':
case 'idm.aa.nl':
if (!isset($_COOKIE['idm_bb_nl_wsid'])) {
$wsid = rand();
setcookie('idm_bb_nl_wsid', $wsid, time()+300, '/');
} else {
$wsid = $_COOKIE['idm_bb_nl_wsid'];
}
header('P3p: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
header('Access-Control-Allow-Origin: *');
setcookie('wsid', $wsid);
$host = $_SERVER['HTTP_HOST'];
echo <<<EOL
(function() {
foo("$host: $wsid");
})();
EOL
;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment