Jump to content

code help please - register_globals off


xxsunshinegodxx

Recommended Posts

Hi all,

 

Just moving my old website to a new server and I can't turn register_globals off. The company that designed the site for me has long gone and I don't know enough about php to do this...any help would be greatly appreciated.

 

The error I am getting when trying to access the page is

[01-Feb-2011 05:37:13] PHP Warning:  Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0

[01-Feb-2011 05:37:14] PHP Warning:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'newquayu_uncover'@'localhost' (using password: YES) in /home/xmasphot/public_html/www.newquayuncovered.com/music/classes/DB_class.php on line 44

 

I have had to change the name of the database and the access details, this has been reflected in other documents but I am guessing that this is trying to use the orignal details somehow???

 

<?

/* Script

* Date Created: 07 Jun, 2004

* Last Updated: 07 Jun, 2004

*

* DB_class.php

*/

  class DB

  {

    //connection parameters

 

    var $host = '';

    var $user = '';

    var $password = '';

    var $database = '';

 

    //Database connection handle

    var $conn = NULL;

    //Query result

    var $result = false;

    var $row;

 

    function DB($host,$user,$password,$database,$persistent = true)

      {

        $this->host = $host;

$this->user = $user;

$this->password = $password;

$this->database = $database;

$this->perstitent = $perstitent;

      }

 

    function open()

      {

      //chose appropriate connect function

      if($this->perstitent)

        {

  $func = 'mysql_pconnect';

}

      else

        {

  $func = 'mysql_connect';

}

      //connect to mysql server

      $this->conn = $func($this->host,$this->user,$this->password);

      if(!$this->conn)

        {

  echo mysql_error();

  exit;

}

      //select the requested database

      if(!mysql_select_db($this->database,$this->conn))

        {

  echo mysql_error();

  exit;

}

        return true;

      }

    function close()

      {

        return(mysql_close($this->conn));

      }

   

    function error()

      {

        return(mysql_error());

      }

 

    function query($sql)

      {

      /*if(!$this->result = mysql_query($sql,$this->conn)){

        echo mysql_error();

exit;

        }*/

$this->result = mysql_query($sql,$this->conn);

        return $this->result;

      }

 

      function fetchobject($result='')

      {

if(!$result){

$result = $this->result;

}

      if(!$res = mysql_fetch_object($result,MYSQL_ASSOC)){

          if(mysql_error() != ""){

    echo mysql_error();

    exit;

  }

}

        return $res;

      }

     

      function fetcharray()

      {

        if(!$res = mysql_fetch_array($this->result,MYSQL_NUM)){

          if(mysql_error() != ""){

    echo mysql_error();

    exit;

  }

}

          return $res;

      }

 

      function fetchfield()

      {

        if(!$res = mysql_fetch_field($this->result)){

          if(mysql_error() != ""){

    echo mysql_error();

    exit;

  }

}

          return $res;

      }

     

function numrows($result='')

  {

    if(!$result){

  $result = $this->result;

}

if(!$res = mysql_num_rows($result)){

          if(mysql_error() != ""){

        echo mysql_error();

        exit;

      }

}

      return $res;

  }

      function affectedrows()

      {

        if(!$res = mysql_affected_rows($this->conn)){

          if(mysql_error() != ""){

    echo mysql_error();

    exit;

  }

}

          return $res;

      }

     

      function insertid()

      {

        if(!$res = mysql_insert_id($this->conn)){

          if(mysql_error() != ""){

    echo mysql_error();

    exit;

  }

}

          return $res;

      }

     

      function freeresult() {

    if(!$res = mysql_free_result($this->result)){

  if(mysql_error() != ""){

    echo mysql_error();

exit;

  }

}

return $res;

      }

 

  function fetchrow($result='') {

if(!$result){

  $result = $this->result;

}

if(!$res = mysql_fetch_row($result)){

  if(mysql_error() != ""){

echo mysql_error();

exit;

  }

}

return $res;

  }

 

  }

 

?>

Link to comment
https://forums.phpfreaks.com/topic/226344-code-help-please-register_globals-off/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.