Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-24-2013, 04:18 PM
GuardiansWish GuardiansWish is offline
Member
 
Join Date: Jun 2012
Posts: 95
Gender: Female
Credits: 8,895
GuardiansWish is on a distinguished road
Default SERIOUS problems with Chibifurs

Okay for the past three months, Chibifurs has been dealing with some severe code issues. As seen here: http://www.chibifurs.com/ we are unable to get into the adopts half of the site. We have gone through the rings with our service providers who have essentially told us to come to you. I have included all screenshots and discussions we have had with them to help.

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

30 Dec.

Hi ----,

This is the error that comes about when an existing site (one with a valid /home/chibifur/public_html/classes/class_database.php ) points to a database that no longer exists.

Check /home/chibifur/public_html/classes/class_database.php and make sure that the database listed in there is able to be connected .

Regards,
Arun

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

Our response back:

http://fc03.deviantart.net/fs70/f/20...sh-d5pukij.png


Our uploaded file:

PHP Code:
<?php

class Database extends PDO{
    
/**
     * Tables' prefix
     *
     * @access private
     * @var string
     */
    
private $_prefix;

    
/**
     * Keep track of total rows from each query
     *
     * @access private
     * @var array
     */
    
private $_total_rows = array();

    
/**
     * Stores join table
     *
     * @access private
     * @var array
     */
    
private $_joins = array();

    
/**
     * If you don't know what this is, you shouldn't be here
     *
     * @param string $dbname
     * @param string $host
     * @param string $user
     * @param string $password
     * @param string $prefix    Tables' prefix
     * @access public
     */
    
public function __construct($dbname$host$user$password$prefix 'adopts_')
    {
        
parent::__construct('mysql:host=' $host ';dbname=' $dbname$user$password);
        
$this->_prefix $prefix;
    }

    
/**
     * Basic INSERT operation
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access public
     * @return object
     */
    
public function insert($tableName, array $data)
    {
        return 
$this->_query($tableName$data'insert');
    }

    
/**
     * Basic UPDATE operation
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access public
     * @return object
     */
    
public function update($tableName, array $data$clause NULL)
    {
        return 
$this->_query($tableName$data'update'$clause);
    }

    
/**
     * Basic SELECT operation
     *
     * @param string $tableName
     * @param array  $data        A key-value pair with values that correspond to the fields of the table
     * @param string $clause    Clauses for creating advance queries with JOINs, WHERE conditions, and whatnot
     * @access public
     * @return object
     */
    
public function select($tableName, array $data$clause NULL)
    {
        return 
$this->_query($tableName$data'select'$clause);
    }

    
/**
     * Basic DELETE operation
     *
     * @param string $tableName
     * @param string $clause    Clauses for creating advance queries with JOINs, WHERE conditions, and whatnot
     * @access public
     * @return object
     */
    
public function delete($tableName$clause NULL)
    {
        return 
$this->_query($tableName, array(), 'delete'$clause);
    }

    
/**
     * Adds JOIN to the next SELECT operation
     *
     * @param string $tableName
     * @param string $cond
     * @access public
     * @return object
     */
    
public function join($tableName$cond)
    {
        
$this->_joins[] = array($tableName$cond);
        return 
$this;
    }

    
/**
     * Get total rows affected by previous queries
     *
     * @param int    $index
     * @return int
     */
    
public function get_total_rows($index)
    {
        if (
$index 0)
        {
            return 
$this->_total_rows[count($this->_total_rows) + $index];
        }
        return 
$this->_total_rows[$index];
    }

    
/**
     * Handles queries
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @param string $operation Defines what kind of operation we'll carry on with the database
     * @access private
     * @return object
     */
    
private function _query($tableName, array $data$operation$clause NULL)
    {
        if ( ! 
is_string($tableName))
        {
            throw new 
Exception('Argument 1 to ' __CLASS__ '::' __METHOD__ ' must be a string');
        }

        if ( ! 
in_array($operation, array('insert''update''select''delete')))
        {
            throw new 
Exception('Unkown database operation.');
        }

        
$query call_user_func_array(array(&$this'_' $operation '_query'), array($tableName, &$data));

        if ( ! empty(
$clause))
        {
            
$query .= ' WHERE ' $clause;
        }
        
//The comments can be removed for debugging purposes.
        //echo $query;
        
$stmt $this->prepare($query);
        
$this->_bind_data($stmt$data);

        if ( ! 
$stmt->execute())
        {
            
$error $stmt->errorInfo();
            throw new 
Exception('Database error ' $error[1] . ' - ' $error[2]);
        }

        
$this->_total_rows[] = $stmt->rowCount();
        return 
$stmt;
    }

    
/**
     * Generates prepared INSERT query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _insert_query($tableName, &$data)
    {
        
$tableFields array_keys($data);
        return 
'INSERT INTO ' $this->_prefix $tableName '
                  (`' 
implode('`, `'$tableFields) . '`)
                  VALUES (:' 
implode(', :'$tableFields) . ')';
    }

    
/**
     * Generates prepared UPDATE query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _update_query($tableName, &$data)
    {
        
$setQuery = array();
        foreach (
$data as $field => &$value)
        {
            
$setQuery[] = '`' $field '` = :' $field;
        }
        return 
'UPDATE ' $this->_prefix $tableName '
                  SET ' 
implode(', '$setQuery);
    }

    
/**
     * Generates prepared SELECT query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with values that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _select_query($tableName, &$data)
    {
        
$joins '';
        if ( ! empty(
$this->_joins))
        {
            foreach (
$this->_joins as $k => &$join)
            {
                
$exploded explode('='$join[1]);
                
$join_cond '`' $this->_prefix implode('`.`'explode('.'trim($exploded[0]))) . '` = `' $this->_prefix implode('`.`'explode('.'trim($exploded[1]))) . '`';   
                
$joins .= ' INNER JOIN `' $this->_prefix $join[0] . '` ON ' $join_cond;
            }
            
$this->_joins NULL;
            
$this->_joins = array();
        }
        
$fields = empty($data) ? '*' '`' implode('`, `'array_values($data)) . '`';
        return 
'SELECT ' $fields '
                  FROM `' 
$this->_prefix $tableName '`' $joins;
    }

    
/**
     * Generates prepared DELETE query string
     *
     * @param string $tableName
     * @access private
     * @return string
     */
    
private function _delete_query($tableName)
    {
        return 
'DELETE FROM `' $this->_prefix $tableName '`';
    }

    
/**
     * Binds data to the prepared statement
     *
     * @param object $stmt A PDOStatement object
     * @param array  $data A key-value pair to be bound with the statement
     * @access private
     * @return object
     */
    
private function _bind_data(&$stmt, &$data)
    {
        if ( ! empty(
$data))
        {
            foreach (
$data as $field => &$value)
            {
                
$stmt->bindParam(':' $field$value);
            }   
        }
        return 
$this;
    }
}

?>

Our base backup file (original):

PHP Code:
<?php

class Database extends PDO{
    
/**
     * Tables' prefix
     *
     * @access private
     * @var string
     */
    
private $_prefix;

    
/**
     * Keep track of total rows from each query
     *
     * @access private
     * @var array
     */
    
private $_total_rows = array();

    
/**
     * Stores join table
     *
     * @access private
     * @var array
     */
    
private $_joins = array();

    
/**
     * If you don't know what this is, you shouldn't be here
     *
     * @param string $dbname
     * @param string $host
     * @param string $user
     * @param string $password
     * @param string $prefix    Tables' prefix
     * @access public
     */
    
public function __construct($dbname$host$user$password$prefix 'adopts_')
    {
        
parent::__construct('mysql:host=' $host ';dbname=' $dbname$user$password);
        
$this->_prefix $prefix;
    }

    
/**
     * Basic INSERT operation
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access public
     * @return object
     */
    
public function insert($tableName, array $data)
    {
        return 
$this->_query($tableName$data'insert');
    }

    
/**
     * Basic UPDATE operation
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access public
     * @return object
     */
    
public function update($tableName, array $data$clause NULL)
    {
        return 
$this->_query($tableName$data'update'$clause);
    }

    
/**
     * Basic SELECT operation
     *
     * @param string $tableName
     * @param array  $data        A key-value pair with values that correspond to the fields of the table
     * @param string $clause    Clauses for creating advance queries with JOINs, WHERE conditions, and whatnot
     * @access public
     * @return object
     */
    
public function select($tableName, array $data$clause NULL)
    {
        return 
$this->_query($tableName$data'select'$clause);
    }

    
/**
     * Basic DELETE operation
     *
     * @param string $tableName
     * @param string $clause    Clauses for creating advance queries with JOINs, WHERE conditions, and whatnot
     * @access public
     * @return object
     */
    
public function delete($tableName$clause NULL)
    {
        return 
$this->_query($tableName, array(), 'delete'$clause);
    }

    
/**
     * Adds JOIN to the next SELECT operation
     *
     * @param string $tableName
     * @param string $cond
     * @access public
     * @return object
     */
    
public function join($tableName$cond)
    {
        
$this->_joins[] = array($tableName$cond);
        return 
$this;
    }

    
/**
     * Get total rows affected by previous queries
     *
     * @param int    $index
     * @return int
     */
    
public function get_total_rows($index)
    {
        if (
$index 0)
        {
            return 
$this->_total_rows[count($this->_total_rows) + $index];
        }
        return 
$this->_total_rows[$index];
    }

    
/**
     * Handles queries
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @param string $operation Defines what kind of operation we'll carry on with the database
     * @access private
     * @return object
     */
    
private function _query($tableName, array $data$operation$clause NULL)
    {
        if ( ! 
is_string($tableName))
        {
            throw new 
Exception('Argument 1 to ' __CLASS__ '::' __METHOD__ ' must be a string');
        }

        if ( ! 
in_array($operation, array('insert''update''select''delete')))
        {
            throw new 
Exception('Unkown database operation.');
        }

        
$query call_user_func_array(array(&$this'_' $operation '_query'), array($tableName, &$data));

        if ( ! empty(
$clause))
        {
            
$query .= ' WHERE ' $clause;
        }
        
//The comments can be removed for debugging purposes.
        //echo $query;
        
$stmt $this->prepare($query);
        
$this->_bind_data($stmt$data);

        if ( ! 
$stmt->execute())
        {
            
$error $stmt->errorInfo();
            throw new 
Exception('Database error ' $error[1] . ' - ' $error[2]);
        }

        
$this->_total_rows[] = $stmt->rowCount();
        return 
$stmt;
    }

    
/**
     * Generates prepared INSERT query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _insert_query($tableName, &$data)
    {
        
$tableFields array_keys($data);
        return 
'INSERT INTO ' $this->_prefix $tableName '
                  (`' 
implode('`, `'$tableFields) . '`)
                  VALUES (:' 
implode(', :'$tableFields) . ')';
    }

    
/**
     * Generates prepared UPDATE query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with keys that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _update_query($tableName, &$data)
    {
        
$setQuery = array();
        foreach (
$data as $field => &$value)
        {
            
$setQuery[] = '`' $field '` = :' $field;
        }
        return 
'UPDATE ' $this->_prefix $tableName '
                  SET ' 
implode(', '$setQuery);
    }

    
/**
     * Generates prepared SELECT query string
     *
     * @param string $tableName
     * @param array  $data         A key-value pair with values that correspond to the fields of the table
     * @access private
     * @return string
     */
    
private function _select_query($tableName, &$data)
    {
        
$joins '';
        if ( ! empty(
$this->_joins))
        {
            foreach (
$this->_joins as $k => &$join)
            {
                
$exploded explode('='$join[1]);
                
$join_cond '`' $this->_prefix implode('`.`'explode('.'trim($exploded[0]))) . '` = `' $this->_prefix implode('`.`'explode('.'trim($exploded[1]))) . '`';   
                
$joins .= ' INNER JOIN `' $this->_prefix $join[0] . '` ON ' $join_cond;
            }
            
$this->_joins NULL;
            
$this->_joins = array();
        }
        
$fields = empty($data) ? '*' '`' implode('`, `'array_values($data)) . '`';
        return 
'SELECT ' $fields '
                  FROM `' 
$this->_prefix $tableName '`' $joins;
    }

    
/**
     * Generates prepared DELETE query string
     *
     * @param string $tableName
     * @access private
     * @return string
     */
    
private function _delete_query($tableName)
    {
        return 
'DELETE FROM `' $this->_prefix $tableName '`';
    }

    
/**
     * Binds data to the prepared statement
     *
     * @param object $stmt A PDOStatement object
     * @param array  $data A key-value pair to be bound with the statement
     * @access private
     * @return object
     */
    
private function _bind_data(&$stmt, &$data)
    {
        if ( ! empty(
$data))
        {
            foreach (
$data as $field => &$value)
            {
                
$stmt->bindParam(':' $field$value);
            }   
        }
        return 
$this;
    }
}

?>
--------------------------------------

30 Dec.

Hi,

Please be informed that the database table chibifur_adopts2.adopts_settings is missing in your database .
Please restore your complete database.

Regards,
Diwakar

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

It wasn't there. I re-uploaded it from one of my backups.

http://fc09.deviantart.net/fs70/f/20...sh-d5qpmur.png


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

Hi ,

We have checked your database but the Table 'chibifur_adopts2.adopts_settings' does not exist in it.

But /home/chibifur/public_html/classes/class_database.php script requires such a table.

Please contact your developer regarding this.


Regards,
Diwakar

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


We are now at the point where we may have to close down the site because of all of this and are begging for help.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Login Problems pepofaec Questions and Supports 8 04-16-2014 08:26 PM
New and having problems. Cremuex Levier Newcomer Center 3 03-28-2013 10:59 AM
Major ACP problems Empress_Swanbottom Questions and Supports 23 03-09-2013 09:09 AM
Adoption Problems Kamalya Questions and Supports 8 01-27-2013 01:15 PM
Chibifurs! GuardiansWish Adoptables Sites Showcase 0 10-04-2012 05:16 PM


All times are GMT -5. The time now is 03:51 AM.

Currently Active Users: 754 (0 members and 754 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636