[PHP-DB] Re: sessions

2004-12-11 Thread Shen Kong
Hi, if your register_global = on you can do it like you do, if 
register_global = off, use it like this:

session_start();
session_register(session_username); //or $_SESSION[session_username] 
= null;
session_register(session_level); // or $_SESSION[session_level] = null;

$_SESSION['session_username'] = $username;
$_SESSION['session_level'] = $account_level;
echo $_SESSION['session_username'];
Warren Mason :
I am attempting to get information from a mysql database and then use
this in a session. Is there a trick to using sessions? For example, can
something like below be placed anywhere in a script? (I have the 
session_start(); at the very top of my page.)  


  session_register( session_username ); 
  session_register( session_level );  
 
 $session_username = $username;
 $session_level = $account_level; 

The resulting session is
session_username|N;session_level|i:0;
$username is set to warren and $account_level is set to 255.
Any help would be greatly appreciated as I have gone through about 5
books and searched the net and can't find an answer as to why this isn't
working.
-
This message is intended for the addressee named and may contain
confidential information. If you are not the intended recipient, please
delete it and notify the sender. Views expressed in this message are
those of the individual sender and are not necessarily the views of the
Mid Western Area Health Service.
-
gwavasig

--
-- ShenKong (shenkong(at)php.net)
-- http://www.openphp.cn
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: sessions

2004-12-11 Thread Joseph Crawford
correct me if i am wrong but i have been told it is bad and insecure
to use register_global=on

i have seen many comercial scripts that rely on this and it just makes me laugh


On Sat, 11 Dec 2004 16:48:05 +0800, Shen Kong [EMAIL PROTECTED] wrote:
 Hi, if your register_global = on you can do it like you do, if
 register_global = off, use it like this:
 
 session_start();
 session_register(session_username); //or $_SESSION[session_username]
 = null;
 session_register(session_level); // or $_SESSION[session_level] = null;
 
 $_SESSION['session_username'] = $username;
 $_SESSION['session_level'] = $account_level;
 
 echo $_SESSION['session_username'];
 
 Warren Mason :
 
 
  I am attempting to get information from a mysql database and then use
  this in a session. Is there a trick to using sessions? For example, can
  something like below be placed anywhere in a script? (I have the
  session_start(); at the very top of my page.)
 
 
 
session_register( session_username );
session_register( session_level );
 
   $session_username = $username;
   $session_level = $account_level;
 
 
  The resulting session is
 
  session_username|N;session_level|i:0;
 
  $username is set to warren and $account_level is set to 255.
 
  Any help would be greatly appreciated as I have gone through about 5
  books and searched the net and can't find an answer as to why this isn't
  working.
 
 
  -
  This message is intended for the addressee named and may contain
  confidential information. If you are not the intended recipient, please
  delete it and notify the sender. Views expressed in this message are
  those of the individual sender and are not necessarily the views of the
  Mid Western Area Health Service.
  -
  gwavasig
 
 -- 
 -- ShenKong (shenkong(at)php.net)
 -- http://www.openphp.cn
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Joseph Crawford Jr.
Codebowl Solutions
[EMAIL PROTECTED]

For a GMail account
contact me OFF-LIST

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



Re: Re: [PHP-DB] Re: sessions

2004-12-11 Thread John Holmes
 From: Joseph Crawford [EMAIL PROTECTED]
 
 correct me if i am wrong but i have been told it is bad and insecure
 to use register_global=on

You are wrong. :)

Having register_globals OFF helps to prevent poorly written programs from being 
vulnerable to users setting variables in the URL/header/cookie data. You can 
still write horribly insecure programs with register_globals OFF. You can 
easily write very secure programs that function with register_globals ON or 
OFF, too. 

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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