Created
February 4, 2015 16:17
-
-
Save dky/c3d9fe6639410df87017 to your computer and use it in GitHub Desktop.
Session cookie php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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