How to test PHP sessions in Memcached?

Well, just run this code :D

<?php
    header('Content-Type: text/plain');
    session_start();
    if(!isset($_SESSION['visit']))
    {
        echo "This is the first time you're visiting this server\n";
        $_SESSION['visit'] = 0;
    }
    else
            echo "Your number of visits: ".$_SESSION['visit'] . "\n";

    $_SESSION['visit']++;

    echo "Server IP: ".$_SERVER['SERVER_ADDR'] . "\n";
    echo "Client IP: ".$_SERVER['REMOTE_ADDR'] . "\n";
    print_r($_COOKIE);
?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

How to test PHP sessions in Memcached?

Well, just run this code :D
[php]
<?php
header(‘Content-Type: text/plain’);
session_start();
if(!isset($_SESSION[‘visit’]))
{
echo “This is the first time you’re visiting this servern”;
$_SESSION[‘visit’] = 0;
}
else
echo “Your number of visits: “.$_SESSION[‘visit’] . “n”;

$_SESSION[‘visit’]++;

echo “Server IP: “.$_SERVER[‘SERVER_ADDR’] . “n”;
echo “Client IP: “.$_SERVER[‘REMOTE_ADDR’] . “n”;
print_r($_COOKIE);
?>
[/php]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s