php-windows | 2003032
Date: 03/19/03
- Next message: Warren \: "[PHP-WIN] RE: Excel Spreadsheet as a datasource"
- Previous message: Uttam: "RE: [PHP-WIN] RE:[newbie]session problem"
- In reply to: Bobby Rahman: "Re: [PHP-WIN] RE:[newbie]session problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
a word of caution right out of manual:
"
Caution
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
session_register(), session_is_registered() and session_unregister().
"
another snip from manual:
"
Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is
recommended for security and code readablity. With $_SESSION or
$HTTP_SESSION_VARS, there is no need to use
session_register()/session_unregister()/session_is_registered() functions.
Users can access session variable like a normal variable.
"
regds,
-----Original Message-----
From: Bobby Rahman [mailto:bobby_rahman2002 <email protected>]
Sent: Tuesday, March 18, 2003 17:45
To: blue_myth_1 <email protected>; php-windows <email protected>
Subject: Re: [PHP-WIN] RE:[newbie]session problem
Hiya
Futher investigation has lead me to some strange results. I checked
phpinfo() and made sure "register global variables is set=on".
I then used:
//In db api
$num_results =mysql_num_rows($db_result);
$_SESSION['num_results'] = $num_results;
//In second file
session_start();
require_once("db_api.php");
echo "THE num_result from db API is ".$_SESSION['num_results'];
This seems to work....
when I try and use register_session() such as:
//In db api
$db_result = mysql_query($querystring);
$num_results =mysql_num_rows($db_result);
session_register("num_results");
//In second file
if (session_is_registered("num_results"))
echo "NUM RESULTS is $num_results";
I dont seem to get a value echoed. Not sure why?
But hopefully $_SESSION will work now...thanks for all your help
Toby and Janet -much appreciated :)
>From: toby z <blue_myth_1 <email protected>>
>To: Bobby Rahman <bobby_rahman2002 <email protected>>,
php-windows <email protected>
>Subject: Re: [PHP-WIN] RE:[newbie]session problem Date: Tue, 18 Mar
2003
>09:05:56 +0000 (GMT)
>
>hi
>try this
>
>initiate session on proc.php
>// init sessn
>session_start();
>
>// register session variblez ! ! ! !
>session_register("SESSN");
>
>
>
>
>chech for session set on sum_page.php
>
><?php
>// sessn chk ! ! ! !
>session_start();
>if(!session_is_registered("SESSN"))
>{
>// sessn chk failed .... invoke error hndlr ! ! ! !
>header("Location: /nologn.php");
>exit();
>}
>
>
>
>the rest of ur code .....
>
>?>
>
>
>hope thid helps
>
>good luck
>
>toby ....
>
>
> --- Bobby Rahman <bobby_rahman2002 <email protected>> wrote: >
> >
> > Hiya,
> >
> > Im running php4.2.3 on Win98 and apache 2.0.43.
> > I am having troubles passing variables from page to page.
> > I try to use:
> >
> > session_start();
> > session_register("test");
> >
> >
> > when echo $test on a different page it seems to be empty
> > when not called from within the page originally created.
> >
> > I have session_start() on every page at the start just under the
> > php syntax
> > <? and also register the variables which I want global.
> >
> > I have edited the php.ini to set the session.save_path =
> > "C:/windows/temp"
> > and also have global variables set on
> >
> >
> > Any suggestions to what it may be as it doesnt seem to produce any
> > errors.
> >
> >
> > Thanks
> >
> > _________________________________________________________________
> > Express yourself with cool emoticons http://messenger.msn.co.uk
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>__________________________________________________
>Do You Yahoo!?
>Everything you'll ever need on one web page
>from News and Sport to Email and Music Charts
>http://uk.my.yahoo.com
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
MSN Messenger - fast, easy and FREE! http://messenger.msn.co.uk
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Warren \: "[PHP-WIN] RE: Excel Spreadsheet as a datasource"
- Previous message: Uttam: "RE: [PHP-WIN] RE:[newbie]session problem"
- In reply to: Bobby Rahman: "Re: [PHP-WIN] RE:[newbie]session problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

