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?

7 Years
Discussion Span
Last Post by saad.khalid

save both of your variables in session with the particular value


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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.