This commit is contained in:
troy 2022-07-22 23:30:10 +02:00
parent af3d7d33a1
commit 79e27ee95a

14
sql.php
View File

@ -9,13 +9,13 @@ class SQL {
public $cnt_set = 0; public $cnt_set = 0;
public function __construct() { public function __construct() {
require_once ('secret.php'); require_once ('secret.php');
$this->m = $_m; $this->m = $_m;
$this->pre = $_m ['pre']; $this->pre = $_m ['pre'];
$this->salt = $_m ['salt']; $this->salt = $_m ['salt'];
if (SQL_LOG) if (SQL_LOG)
$this->f = fopen ( 'sql.log', 'w' ); $this->f = fopen ( 'sql.log', 'w' );
$this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] ); $this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] );
if ($this->h->connect_errno) { if ($this->h->connect_errno) {
return false; return false;
@ -28,7 +28,7 @@ class SQL {
if (SQL_LOG) if (SQL_LOG)
fputs ( $this->f, str_replace ( array ( fputs ( $this->f, str_replace ( array (
"\n", "\n",
" " " "
), array ( ), array (
' ', ' ',
'' ''
@ -73,9 +73,9 @@ class SQL {
$statement->bind_param ( $t, $p ); $statement->bind_param ( $t, $p );
} }
$statement->execute (); $statement->execute ();
$ret = array (); $ret = array ();
// print_r($statement); // print_r($statement);
if (isset ( $statement->error ) && $statement->error != '') { if (isset ( $statement->error ) && $statement->error != '') {
if (SQL_LOG) if (SQL_LOG)
@ -127,7 +127,7 @@ class SQL {
if (SQL_LOG) if (SQL_LOG)
fputs ( $this->f, str_replace ( array ( fputs ( $this->f, str_replace ( array (
"\n", "\n",
" " " "
), array ( ), array (
' ', ' ',
'' ''
@ -176,7 +176,7 @@ class SQL {
fputs ( $this->f, $statement->error ); fputs ( $this->f, $statement->error );
return false; return false;
} }
if ($id) { if ($id) {
return $statement->insert_id; return $statement->insert_id;
} else { } else {