Stop using session_register, and start using:

$_SESSION['refString'] = $_GET['refNo'];

And, actually, you should do something more like this:

$refNo = (int) $_GET['refNo']; //sanitize input
$_SESSION['refString'] = $refNo;

The MORE specific you can be about what is a VALID $refNo, in place of
the (int) typecast, the better.

On Wed, January 16, 2008 1:20 am, tbt wrote:
>
> Hi
>
> I have two php files as follows
>
> session_register.php // sets the value of $refString
> <?php
> session_start();
> session_register("refString");
> $refString = $_GET['refNo'];
> ?>
>
> and
>
> session_data.php // retrieves the value of $refString
> <?php
> session_start();
> echo $refString;
> ?>
>
> This code works fine when register_globals is set to 'on'. But the
> hosting
> site has set it to 'off' and I have no way of adding a .htaccess file.
> Is
> there anyway to modify my php files so that it works correctly when
> register_globals is set to 'off'. I only need the value of the
> variable
> $refString accessible from all the php files.
>
> Thanks
>
>
>
> tbt wrote:
>>
>> Hi,
>>
>> I'm a newbie to php and i would like to set register_globals to 'on'
>> from
>> my php script itself(eg:- index.php). Is there any way of doing
>> this.
>>
>> Thanks
>>
>
> --
> View this message in context:
> http://www.nabble.com/register_globals-tp14868899p14871630.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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

Reply via email to