Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* PHP Tracker class. Version shithouse 0.2 lol
- * Evan Harrison 2012
- */
- class tracking {
- var $cookievar;
- public function start_cookie($cookievar) {
- if (isset($_COOKIE)) {
- if ($_COOKIE[$cookievar] == '') {
- tracking::create_cookie($cookievar, $_SERVER['HTTP_REFERER'], time() + 3600);
- //echo "This is a new cookie";
- } else {
- $this->cookievar = $_COOKIE;
- }
- }
- }
- private function create_cookie($name, $ref, $expire) {
- if (isset($_SERVER['HTTP_REFERER'])) {
- $this->cookievar = setcookie($name, $ref, $expire);
- } else {
- // code to handle no referer here
- }
- return true;
- }
- public function output($cookievar) {
- if (isset($_COOKIE[$cookievar])) {
- $success = $_COOKIE[$cookievar];
- } else {
- $success = "<p>No cookie of that name found.</p>";
- }
- return $success;
- }
- public function destroy_cookie($cookievar) {
- $cookievar = setcookie($cookievar, "", time() - 3600);
- return $cookievar;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment