Session Not Starting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justravis
Forum Commoner
Posts: 53
Joined: Mon Dec 16, 2002 3:18 am
Location: San Diego, CA
Contact:

Session Not Starting

Post by justravis »

I created a 'nologin' page to my site for those users that don't want to bother with logging in. It's a temporary substitute for IP authentication.

For one subscriber, the session will only start from one computer on campus. It has Windows XP & IE6. The computers that cannot start a session have Windows XP or another older version of Windows and IE & NS 6 or older. Is there a setting somewhere that would disrupt the session starting process??? Since I'm not using cookies, cookie settings are irrelevent right?

Since only 1 subscriber is complaining, I'm assuming it is a isolated incident. The nologin page seems pretty simplistic, but do you see any errors????

Code: Select all

<?php

#PG ENABLES USERS TO BYPASS LOGIN

if($_GET[user])
{
        include 'functions.phps';

        session_start();

        $_SESSION['user']=$_GET[user];

        #userip($_SESSION['user']);

        $nologin=$_SESSION['user'];
}

header("Location: http://website.com?nologin=$nologin");

?>
Last edited by justravis on Wed Mar 19, 2003 7:05 pm, edited 1 time in total.
User avatar
lazy_yogi
Forum Contributor
Posts: 243
Joined: Fri Jan 24, 2003 3:27 am

Re: Session Not Starting

Post by lazy_yogi »

change this
if($_GET[user])
and
$_SESSION['user']=$_GET[user];
to
if($_GET['user'])
and
$_SESSION['user']=$_GET['user'];
opedroso
Forum Newbie
Posts: 1
Joined: Wed Mar 19, 2003 6:24 pm
Location: Northern California

Related problem

Post by opedroso »

Assume the string "user" is actually coming from an array, so I end up having $varName="user" and then accessing the _get like this:

[quote] $_SESSION['user']=$_GET[$varName]; [/quote]

In this case, do I have to add ticks around the string "user" before accessing it? (Something like forcing $varName="'user'", or $varName equal quote tick user tick quote)

Thanks
justravis
Forum Commoner
Posts: 53
Joined: Mon Dec 16, 2002 3:18 am
Location: San Diego, CA
Contact:

Post by justravis »

I received 2 e-mails from the user.

First, he told me the quote changes did not make a difference. (Thanx anyway.)

His next e-mail said this:
OK, I've figured out what the trouble is. I finally thought to check my
browser's "privacy report," which logs whether cookies are accepted or
blocked, and found that cookies from your site were being blocked (even
though my Internet Explorer security level is set to "low". This
appears not to be a problem on your end after all, although I'm
surprised that my browser refused cookies from your site.
I'm just using sessions. Not setting any cookies. Why are these browser settings relevent? Is there a workaround?
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

Are you sure you aren't using cookies. By default PHP passes the session id along via a cookie. It should also fall back to appending the sessionid to the url if the cookie can't be set (if you have enable-trans-sid turned on).
Post Reply