Jump to content

Help with register_globals


lew14

Recommended Posts

I have several scripts that require register_globals.  I do not use globals for security reasons.  Is there a way to recode so the script will work without it?

 

The code I am trying to change is:

foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};}

and

function brotator($br_rid) {

global $url,$dbhost,$dbuser,$dbpass,$dbname;

$db = mysql_pconnect($dbhost, $dbuser, $dbpass) or die("Could not connect");

 

I have included the actaul file also.

 

Thanks for any help you can give me.

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

The first bit of code imports global variables into a scope (such as function scope). That doesn't need any changing.

 

For the second bit, the four $db variables are probably defined somewhere - not from form input. $url, on the other hand, might be from a form, in which case a simple

$url = $_POST["url"]; // or $_GET["url"]

at the beginning of the function would be enough.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.