RE: [PHP-DB] problem with starting a session

2003-07-15 Thread Sourabh G
To make it little more clear, always write session_start() on the top of the 
page. Because if you output some thing to the browser without starting a 
session will show you these kind of error.

-Sourabh


From: Ford, Mike   [LSS] [EMAIL PROTECTED]
To: 'Ahmed Abdelaliem' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP-DB] problem with starting a session
Date: Tue, 15 Jul 2003 10:29:06 +0100
 -Original Message-
 From: Ahmed Abdelaliem [mailto:[EMAIL PROTECTED]
 Sent: 15 July 2003 08:54

 i have a problem with starting a session in the page that
 validates the user
 input and sends it tothe database,
 when the user clicks register he gets this error

 Warning: session_start(): Cannot send session cookie -
 headers already sent
 by (output started at
 c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89

 Warning: session_start(): Cannot send session cache limiter - headers
 already sent (output started at
 c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89


 and here is the code i wrote :
There must be  approximately 73 lines before this, as the error message 
says
the session_start() is on line 89.  Your problem is that one of those lines
is an include/require for data_valid_fns.php, and line 25 of that file
outputs something that can't be output before the session_start().  Take a
look there and work out how you can fix that.

 ?
  $email=$HTTP_POST_VARS['email'];
  $passwd=$HTTP_POST_VARS['passwd'];
  $passwd2=$HTTP_POST_VARS['passwd2'];
  $title=$HTTP_POST_VARS['title'];
  $name1=$HTTP_POST_VARS['name1'];
  $name2=$HTTP_POST_VARS['name2'];
  $phone=$HTTP_POST_VARS['phone'];
  $mobile=$HTTP_POST_VARS['mobile'];
  $address1=$HTTP_POST_VARS['address1'];
  $address2=$HTTP_POST_VARS['address2'];
  $town=$HTTP_POST_VARS['town'];
  $pb=$HTTP_POST_VARS['pb'];
  $country=$HTTP_POST_VARS['country'];
  $occupation=$HTTP_POST_VARS['occupation'];

 session_start();
Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

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


[PHP-DB] Why old session poping up in new Browser window

2003-07-11 Thread Sourabh G
Hi,

Session problem.

I am getting a weird session problem in my site.

Background of the Problem:
--
My site use sessions for user authentication. Site has a Admin Panel where
admin can search users and then through a link

(which has login and password appended) login as user.

On login as user, session var changes to the new user vars, like user id
etc. So, if some one try to access any thing on

admin panel, they get error which is quite evident why is that happened. The
login user is not a admin any more, its a normal

user with no privilege.

I came to a conclusion that if I spawn new browser window it takes old
session. After trying for hours, I was able to solve

this. I started a new session when I login as user by setting session name
and storing the other vars. This way I can start

the session as needed.

After solving this problem I thought I am done. But some thing really weird
popped up. The links on the page, like My

Account, Change Password goes to admin when I click them. This looks like
on clicking the link, Old admin session becoming

active and showing the page as a admin. I have no idea why is that
happening. I have searched goggle but no result.

Is it a browser issue, or php issue, or I am doing something wrong.


* I have compiled PHP with trans-sid option.
** I store session in my sql database. I can see the user session active.

Ideal Solution:-)
--

When I search the user and login as user. Both admin and user session remain
alive and I can work on both windows seamlessly.

Can Any one point me in the right direction.

Thanks




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