Jump to content

Magic quotes


hyldig

Recommended Posts

Hi.

 

I am not that familiar with PHP, but I have managed to integrate a small php cms-system.

However certainly I have this huge problem:

Whenever I try to login to the system, I get the following message:

"Warning: array_map(): Argument #2 should be an array in settings.php on line 34 Vedligeholdelse filmoversigt - login"

 

Settings.php looks like this - the bold line being line 34:

-------------------

session_start();

// Hangle Magic Quotes for REQUEST & COOKIE.  POST & GET are handled elsewhere.

if (!get_magic_quotes_gpc()) slashString_gpc();

 function slashString($v) {
   return is_array($v) ? array_map('slashString', $v) : addslashes($v);
 }
 
 function unSlashString($v) {
   return is_array($v) ? array_map('unSlashString', $v) : stripslashes($v);
 }

 function slashString_gpc() {
   foreach (array('REQUEST', 'COOKIE') as $gpc)
   $GLOBALS["_$gpc"] = array_map('slashString', $GLOBALS["_$gpc"]);
 }

db_connect();
$sql = "SELECT * FROM " . PDB_PREFIX . "configuration";
$result = db_query($sql);
while($row = db_fetch_array($result)){
    define($row['config_key'], $row['config_value']);
}

-------------------

 

Can anyone og you clerver guys explain what the problem is, and what to do to solve it?

 

Best regards

Hyldig

Link to comment
Share on other sites

My goodness that is some really old code.  

 

What CMS are we talking here?

function slashString_gpc() {
   foreach (array('REQUEST', 'COOKIE') as $gpc)
   $GLOBALS["_$gpc"] = array_map('slashString', $GLOBALS["_$gpc"]);
 }

Inside there looks like it should be:

function slashString_gpc() {
   foreach (array('REQUEST', 'COOKIE') as $gpc)
   $GLOBALS[$gpc] = array_map('slashString', $GLOBALS[$gpc]);
 }
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.