-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforward.php
55 lines (48 loc) · 1.39 KB
/
forward.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include('session.php');
// Entry Page
switch ($entry) {
case '/aSubpage/':
$entryid = 'a01';
break;
case '/anotherSubpage/':
$entryid = 'a02';
break;
case '/':
$entryid = 'hmp';
break;
default:
$entryid = 'NA';
}
// Exit Page
switch ($_SERVER['HTTP_REFERER']) {
case 'https://www.yourdomain.tld/aSubpage/':
$exitid = 'a01';
break;
case 'https://www.yourdomain.tld/anotherSubpage/':
$exitid = 'a02';
break;
case 'https://www.yourdomain.tld':
$exitid = 'hmp';
break;
default:
$exitid = 'NA';
}
// Screen Width
$size = $_SESSION['width'];
// Log Redirect
$ipAddress = $_SERVER['REMOTE_ADDR'];
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
$ipAddress = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
}
$log_entry = time().','.$ipAddress.','.$entryid.','.$exitid.','.$size.',"'.$_SERVER['HTTP_USER_AGENT'].'"';
$log = file_put_contents(date('Y-m').'.txt', $log_entry.PHP_EOL , FILE_APPEND);
$sid = $entryid.$exitid.$size;
$url = '//example.tld/?sid='$sid;
header( 'X-Robots-Tag: noindex, nofollow', true);
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
header( 'refresh:0;url='.$url );