Skip to content

Instantly share code, notes, and snippets.

@dky
Created February 4, 2015 16:17
Show Gist options
  • Save dky/c3d9fe6639410df87017 to your computer and use it in GitHub Desktop.
Save dky/c3d9fe6639410df87017 to your computer and use it in GitHub Desktop.
Session cookie php
<?php
header('Content-Type: text/plain');
session_start();
if(!isset($_SESSION['visit']))
{
echo "This is the first time you're visiting this server";
$_SESSION['visit'] = 0;
}
else
echo "Your number of visits: ".$_SESSION['visit'];
$_SESSION['visit']++;
echo "\nServer IP: ".$_SERVER['SERVER_ADDR'];
echo "\nClient IP: ".$_SERVER['REMOTE_ADDR'];
echo "\nX-Forwarded-for: ".$_SERVER['HTTP_X_FORWARDED_FOR']."\n";
echo "2\n";
echo date("m/d/y-G:i:s\n");
print_r($_COOKIE);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment