Php/アクセス解析コード
提供: 初心者エンジニアの簡易メモ
2015年5月20日 (水) 03:18時点における127.0.0.1 (トーク)による版 (ページの作成:「*index.html <<nowiki />script type="text/javascript"><<nowiki />!-- if (document.referrer.length != 0) { document.write('<<nowiki />img src="/refererimg?ref='+ en...」)
- index.html
<script type="text/javascript"><!--
if (document.referrer.length != 0) {
document.write('<img src="/refererimg?ref='+ encodeURI(document.referrer) + '" />');
}
// -->
</script>
- index.php
// jsで渡されたurlをサニタイズしてdbへ
$url = $_GET['ref'];
// 1pxの画像
header("Content-type: image/gif");
echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
