Skip to content

Commit

Permalink
Merge pull request #20 from Reflow1319/master
Browse files Browse the repository at this point in the history
Update Cookie Handling
  • Loading branch information
Kryptonit3 authored Apr 23, 2017
2 parents 4ddafc9 + 48b24c5 commit aaafcb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Counter.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private function processHit($page)
*/
private static function hashVisitor()
{
$cookie = Cookie::get('kryptonit3-counter');
$cookie = Cookie::get(env('COUNTER_COOKIE', 'kryptonit3-counter'));
$visitor = ($cookie !== false) ? $cookie : $_SERVER['REMOTE_ADDR'];

return hash("SHA256", env('APP_KEY') . $visitor);
Expand Down
4 changes: 2 additions & 2 deletions src/routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

Route::group(['middleware' => ['web']], function () {
if (Cookie::get('kryptonit3-counter') == false) {
Cookie::queue('kryptonit3-counter', str_random(80), 2628000); // Forever aka 5 years
if (Cookie::get(env('COUNTER_COOKIE', 'kryptonit3-counter')) == false) {
Cookie::queue(env('COUNTER_COOKIE', 'kryptonit3-counter'), str_random(80), 2628000); // Forever aka 5 years
}
});

0 comments on commit aaafcb9

Please sign in to comment.