Well, um... Up to now I've been using a free host to do all my PHP messing around, and I've decided to purchase a decent web host and get serious. I previously had a great deal of help with securing my MySQL queries so that they wouldn't be injected, and I greatly appreciate colweb's help :)

I've got some problems with the PHP flag register_globals. As a noob, I had them left on so everything was much easier to do. I've now found out that they carry security risks and I'd like to leave them off this time round.

However, I'm stuck as to how I now access my global variables. Back then, I just declared them as on line 1, and accessed them using line 2.

global $variable1, $variable2;
$variable1 = 'hi';

If I turn these register_globals off, how do I replicate the same functionality?

Are you trying to pass data across pages, or within functions on the same page?

Use session variables.

save both of your variables in session with the particular value

$_SESSION='hi';
$_SESSION='hello';

But remember to add session_start() on the top of the page wherevr you want to access or edit the session values

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.