RE: [PHP] register session

2002-04-03 Thread SHEETS,JASON (Non-HP-Boise,ex1)

Make sure you have session_start() before any output is sent to the browser,
also look for whitespace at the top of your file, sometimes a blank line or
a space can cause this error.

The reason you get this error is session_start() needs to add information to
the headers but because they have already been sent it can't.  You can
either put session_start before any output or you can enable output
buffering.

If this doesn't work let me know.

Jason

-Original Message-
From: Kris Vose [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 10:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] register session


I am trying to register a session after verification of username and
password.
 
It looks like this:
 
session_start();
If ($name = $aa) && ($username = $ab)
{
session_register("valid_user");
echo "window.location=\'admin_.php'\";
}
else
{
echo "Your username/password is incorrect";
}
 
On each page that I want secure I include a script that checks for the
session_register().  It looks like this:
 
session_start();
global $valid_user;
 
if (session_is_registered("valid_user"))
{
echo "you are registered";
}
else
{
echo "you are not registered";
}
 
This code is not working and it sends a warning message like this: Warning:
Cannot send session cache limiter - headers already sent (output started at
/var/www/focus-capital/BetterBus/1/admin_.php:7) in
/var/www/focus-capital/BetterBus/1/admin_.php on line 126
you are registered 1 - Send Mail
 
I have not used sessions before and I am wondering if I am doing some wrong
with the syntax?
 

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




RE: [PHP] register session

2002-04-03 Thread Vlad Kulchitski

Kris,

Idi na phpbeginner.com tam est 'tutorials' dlya tebya.

Vlad

-Original Message-
From: Kris Vose 
Sent: 3 êâ³òíÿ 2002 ð. 12:42
To: [EMAIL PROTECTED]
Subject: [PHP] register session

I am trying to register a session after verification of username and password.
 
It looks like this:
 
session_start();
If ($name = $aa) && ($username = $ab)
{
session_register("valid_user");
echo "window.location=\'admin_.php'\";
}
else
{
echo "Your username/password is incorrect";
}
 
On each page that I want secure I include a script that checks for the 
session_register().  It looks like this:
 
session_start();
global $valid_user;
 
if (session_is_registered("valid_user"))
{
echo "you are registered";
}
else
{
echo "you are not registered";
}
 
This code is not working and it sends a warning message like this: Warning: Cannot 
send session cache limiter - headers already sent (output started at 
/var/www/focus-capital/BetterBus/1/admin_.php:7) in 
/var/www/focus-capital/BetterBus/1/admin_.php on line 126
you are registered 1 - Send Mail
 
I have not used sessions before and I am wondering if I am doing some wrong with the 
syntax?
 

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




Re: [PHP] Register session in function without global?

2001-03-22 Thread Tobias Talltorp

Well... Whadda ya know. Right after I sent the post I figured it out.
(Solution? Variable variables!)

function register_vars($reg_var) {

// Make the $reg_var global
$global_vars=explode("|", $reg_var);
for ($i=0; $i wrote in message
99dn35$duo$[EMAIL PROTECTED]">news:99dn35$duo$[EMAIL PROTECTED]...
> I am trying to register a session variable in a function without using the
> global in the beginning.
> The reason for this is that I don´t always know how many variables I am
> going to register (I separate the different fields with | like this,
> "username|email|cellphone" and explode them).
>
> Is there some way I can make all the variables in the function global, so
I
> can get the session variables registered?
>
> function test() {
> global $username // <-- With this, it works. Without it, it doesn´t
> session_start();
> $username="tobias";
> session_register("username");
> }
>
> The best I could come up with was (didn´t work):
> global $HTTP_SESSION_VARS;
>
> Any thoughts?
> // Tobias
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Register session in function without global?

2001-03-22 Thread Chris Lee

so your trying to take a list of variables and register them as session vars?

 $val)
  {
   global $val;
   session_register($val);
  }
 }

?>

this will work for that.


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message 
99dn35$duo$[EMAIL PROTECTED]">news:99dn35$duo$[EMAIL PROTECTED]...
I am trying to register a session variable in a function without using the
global in the beginning.
The reason for this is that I don´t always know how many variables I am
going to register (I separate the different fields with | like this,
"username|email|cellphone" and explode them).

Is there some way I can make all the variables in the function global, so I
can get the session variables registered?

function test() {
global $username // <-- With this, it works. Without it, it doesn´t
session_start();
$username="tobias";
session_register("username");
}

The best I could come up with was (didn´t work):
global $HTTP_SESSION_VARS;

Any thoughts?
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Register session in function without global?

2001-03-22 Thread CC Zona

In article <99dn35$duo$[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] ("Tobias Talltorp") wrote:

> I am trying to register a session variable in a function without using the
> global in the beginning.

You can pass the variable(s) to the function as an argument.  Perhaps it 
will be easier to deal with a variable number variables  by  packing all 
of them into a single array, then passing the array.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]