Re: Re: why are session only working with cookies?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2005-05-14 at 22:44, Richard Lynch wrote:
> Using Cookies, or using URL, the session DATA will be stored on the server
> in /tmp files -- Unless you change php.ini to store them somewhere else,
> in which case, again, the Cookie and URL only holds the ID and all the
> data goes wherever you store it:  database, shared memory, or an army of
> elves for all PHP cares.
> 
> If trans_sid is "not working" for you, let's narrow this down:
> 
> If you do this:
> <?php
>   session_start();
>   echo "<a href=\"yourdomainnamehere.com\">click me</a><br />\n";
> ?>
> 
> Do you see something like "?PHPSESSID=a847hjfu3734hgfjgurur" tacked on to
> the end of the URL?
> 
> If not, trans_sid is NOT enabled.

I don't see the session id string, BUT, I do have session.use_trans_sid
= 1 set in php.ini and I did restart Apache after setting it.. I can see
the session file being created in /tmp but the values are not being
incremented as they should per script below.

> 
> Did you restart Apache?

Yes.

> 
> Did you turn *OFF* Cookies?  If PHP *can* use Cookies, I think it's gonna
> use Cookies, and not bother with the trans_sid stuff, though maybe it
> always puts it there.  I never really dived into that.  To be certain,
> though, turn off Cookies in php.ini and/or in your browser.

I did turn them off in the browser. And tried in php.ini at some point.

> 
> Re-start Apache for your php.ini changes to kick in.

Did that...

Is it something with my script?


$xsl = new DOMDocument;
$xsl->load('quotes.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

// get elements to operate on
$quotes = $xml->getElementsByTagName('quote_text');
$authors = $xml->getElementsByTagName('quote_author');

// store element values into array
foreach ($authors as $author) {
        $author_result[] = $author->nodeValue;
}
foreach ($quotes as $quote) {
    $quote_result[] = $quote->nodeValue;
}

session_start(); 
header("Cache-control: private"); // IE 6 Fix

if (!isset($_SESSION['user_quotes']) || $_SESSION['user_quotes'] >=
count($quote
_result) - 1) {
   $_SESSION['user_quotes'] = 0;
} else {
   $_SESSION['user_quotes']++;
}

// convert to simple var
$user_quotes = $_SESSION['user_quotes'];

// session debug stuff
/*
echo "<pre>";
echo $_SESSION['user_quotes'] . "\n";
print_r($_SESSION);
echo "Session Id:" . session_id();
echo "</pre>";
*/

if(isset($user_quotes)) {
        $quote = htmlentities($quote_result[$user_quotes]);
    $name = $author_result[$user_quotes];
}

$proc->setParameter('', 'quote', $quote);
$proc->setParameter('', 'name', $name);
$output = $proc->transformToXML($xml);

?>


-- 

s/:-[(/]/:-)/g


Brian        GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux