Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CLASSE DE CONEXÃO
- <?php
- <?php
- include('../config/config.php');
- $op_cdb = new OP_Config();
- class DB {
- private $conn;
- public function getConnection($DATES_DB) {
- try {
- $this->conn = new PDO(
- 'mysql:host=$op_cdb->datesDb->config["db_server"];$op_cdb->datesDb->config["db_name"]',
- $op_cdb->datesDb->config["db_user"],
- $op_cdb->datesDb->config["db_pass"]
- );
- } catch (PDOException $e) {
- print "Erro!: " . $e->getMessage() . "<br/>";
- die();
- }
- }
- }
- ?>
- #CLASSE CONFIG
- <?php
- /**
- @package OnePainel
- @version 1.0
- @author x[C]oder <contato@thebigxcoder.net>
- */
- class OP_Config{
- public $config = array();
- public $path = array();
- public function datesDb($config) {
- $this->config['db_server'] = "localhost";
- $this->config['db_name'] = $_POST['db_name'];
- $this->config['db_user'] = "root";
- $this->config['db_pass'] = "";
- }
- public function paths($path) {
- $this->path['base_url'] = "http://localhost/projects/OnePanel";
- $this->path['modules'] = "/model/modules";
- $this->path['config'] = "/config";
- $this->path['install'] = "/install";
- $this->path['sql'] = "/sql";
- $this->path['adm'] = "/adm";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement