Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Session Cookie inconsistency

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Session Cookie inconsistency

Postby Hadleigh » Wed Mar 19, 2003 10:33 am

Hi,

I have a question more than a problem.

I've got a login system that is (where user cookies are switched off) passing the PHPSESSID around to track user movements.

This behavior appears inconsistent under different circumstances. Here's a few examples.

if the URL is hard-coded as in this example it will append the PHPSESSID okay.

<a href="home.php">

But not if it's this:

<a href="http://my-domain.co.uk/home.php">

Also, not if it's this:

$url="http://my-domain.co.uk";

<a href="<?echo"$url";?>/home.php">

If I make a form like so:

<Form name="foo" Action="home.php">

it will work, but it puts the PHPSESSID in a hidden field within the form.

And:

<Form name="foo" Action="<?echo"$url";?>/home.php">

does the same.


If I do

$page="home.php";

<Form name="foo" Action="<?echo"$url/$page";?>">

it displays no PHPSESSID at all.

Lastly, the site has a Content Management System within it which displays URL's and if I push the following out of the CMS:

<a href="home.php">

it works, but not:

<a href="http://my-domain.co.uk/home.php">

Can anyone lead me to the rules with regards to this?

Thanks guys and gals,

Hadleigh.
Hadleigh
New php-forum User
New php-forum User
 
Posts: 32
Joined: Tue Feb 04, 2003 10:32 am
Location: UK

Postby Redcircle » Fri Mar 21, 2003 10:12 am

Why are cookies turned off. You should make note that there are talks of deprecating the function to track sessions through URL.

may sound stupid but are you sure you have session_start() at the top of each page.

another thing is you can manually add the session id to the URL by adding &PHPSESSID=<?php session_id();?>
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.