Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
8.1.8
Disk Space
203.89 GB
Server Addr
171.9.3.2
Your IP
171.9.3.1
Edit File
File:
<?php //CLASSE DE CONEXÃO (SEPAREI OS DADOS DE CONEXÃO DA CONEXÃO) class Conexao extends Connection { public $conexao = null; public function conecta ($hostname, $username, $database, $pass = null) { try { if ($pass == null) { $pass = 'C@a#156cAm@rA_32'; } $this->conexao = new PDO('mysql:host=' . $hostname . ';dbname='. $database, $username, $pass); return $this->conexao; } catch (Exception $erro) { echo $erro->getMessage(); } } public function desconecta() { $this->conexao = null; } // PRINCIPAL MUDANÇA DESSA CLASSE, AS VARIÁVEIS SÁO PASSADAS VIA ARRAY (PDO) public function consulta($query, $array = null ) { $this->conexao->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $consulta = $this->conexao->prepare($query); $consulta->execute($array); //$consulta->debugDumpParams(); return $consulta; } public function resultado($query) { $lista = $query->fetch(PDO::FETCH_ASSOC); return $lista; } public function registros($query) { $totalReg = $query->rowCount(); return $totalReg; } public function retorna_id() { return $this->conexao->lastInsertId(); } }