On Thu, 19 Aug 2004 16:50:28 -0400, Don <[EMAIL PROTECTED]> wrote:
> Q1. Is this because sessions use session cookies and IE blocks these at high
> security?
> 
> Q2. I was told that if cookies are turned off, there is a way to use the
> session ID variable to accomplish what I want instead of cookies.  How can I
> do this OR please point me to an easy tutorial.

Basically, in order for your session to work, you have to let the page
that you're viewing know what the session id is.  Let's look at your
code.

> ====== Start of code ======
> <?PHP
> session_start();
> header("Cache-control: private"); //IE 6 Fix
> if(!$_SESSION['count']){
>     $_SESSION['count'] = 1;
> } else {
>     $_SESSION['count']++;
> }
> ?>
> You have visited <? echo $_SESSION['count']; ?> pages so far!
> ======= End of code =======

Looking at this code, there's no link to another page, so there's no
way of letting the web server (and PHP in this case) know what the
session id is.  If your php.ini hasn't been changed, you could see the
session in action by adding a link that points to the same page.  Say
for example, the name of this file is 'session.php'.  Add the
following line to your page:

<a href="session.php">See the session in action!</a>

PHP will rewrite this to:

<a href="session.php?SID=12345678123456781234567812345678">See the
session in action!</a>

Clicking on the link will then show $_SESSION['count'] incrementing. 
You should have seen something similar even if you have cookies the
first time you start your browser (assuming your only using session
cookies) since PHP hasn't received any session information from the
browser.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to