Forum Moderators: coopster

Message Too Old, No Replies

cookies or no cookies

         

kumarsena

8:54 pm on Oct 14, 2004 (gmt 0)

10+ Year Member



just wondering how to set a session without settting cookies. I believe cokies are default when working with sessions, rite? can tfind anything on google on this issue...

i have a skinngin script that doesnt work in explorer, i believe because of cookie support.

setskin script:

<?php
session_start();

//get $art
//check if 'art' is set
if(!isset($_GET['art']))
{
$art = 'index.txt';
}

else{
$art = $_GET['art'];
}

//check if 'skin' is set
if(!isset($_GET['skin']))
{
$skin = 'flyaway_yellow3.css';
}

else{
$skin = $_GET['skin'];
}

// Register session key with the value
$_SESSION['skin'] = $skin;

header("Location: index.php?art=$art")

?>

get skin:

<?php
session_start();

//session code for skins
//header('Cache-control: private'); //IE 6 Fix

if ( isset($_SESSION['skin']) ) {

$skin = $_SESSION['skin'];
}

else {
$skin = "flyaway_yellow3.css";

}

//end session code

//start art code for main content
if(isset($_GET['art']))
{

if ($_GET['art']=='index.php')
{
$art='index.txt';
}

else
{
$art= $_GET['art'];
}
}

else{
$art='index.txt';
}

Timotheos

11:29 pm on Oct 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's some settings in php.ini for this


session.use_cookies
session.use_cookies specifies whether the module will use cookies to store the session id on the client side. Defaults to 1 (enabled).

session.use_only_cookies
session.use_only_cookies specifies whether the module will only use cookies to store the session id on the client side. Defaults to 0 (disabled, for backward compatibility). Enabling this setting prevents attacks involved passing session ids in URLs. This setting was added in PHP 4.3.0.

With defaults PHP will handle this automatically. If it can't set a cookie then it will use the session id in the url.

mincklerstraat

8:40 am on Oct 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One possibility is that ie is rejecting 'cookies from a different domain' and your site frames content coming from a different domain (like all .tk sites).

If you can't get to your php.ini file, you can set either of these which Timotheos suggests with ini_set() at the top of your scripts;
ini_set('session.use_cookies', 0); to turn on url-based sessions. However, this can affect your search engine friendliness. Maybe you can conditionally start the session - if(!empty($_GET['PHPSESID'])){ session_start(); if(isset .... etc.
}
and block access to your skin switcher with robots.txt.

Php session id's in the url's won't be your only problem with search engine friendliness, though - it's likely that you will have some negative effects in your rankings from the fact that you use a frame to insert all content from another domain. If you want your site to do well in the search engines, I'd really try to find another domain where you don't have to do this. I do believe the .net and .org for your domain name are free, and you should be able to get one of these from a decent registrar for less than $10 a year. This will save you a lot of grief when it comes to trying to promote your site, and it might solve your cookies - in - ie problem. Getting people to visit your site when you begin can be a pain and the SE's can really help you.

kumarsena

9:20 am on Oct 15, 2004 (gmt 0)

10+ Year Member



actually it was my fault...had set ie to block cookies. he he havent used ie for a long time, so having a little trouble getting around...as for teh .tk domain it is a re-direct rather than a frame sort of thing u talk abt. besides that is a project (tk project - do a google) is a nice one aiming to help with education and health issues on that island.

kumar