0byt3m1n1
Path:
/
home
/
k74ns2xygros
/
www
/
globetech
/
cms
/
admin
/
[
Home
]
File: database.php
<?php date_default_timezone_set('Asia/Kolkata'); include '../assets/connection.php'; class Database { var $conn; function __construct() { $con = new connection(); $this->conn = $con->connect(); } // function __construct(){ // $this->conn = new mysqli("178.32.0.124", "blogworm_iglobe", "~RG*XyZ05%+1", "blogworm_globe"); // } public function select_array($tbl, $cnd=null){ $sql = "SELECT * FROM ".$tbl; if($cnd!=null){ $sql.=" WHERE ".$cnd; } $result = $this->conn->query($sql); if ($result->num_rows > 0) { return mysqli_fetch_all($result,MYSQLI_ASSOC); }else{ return array(); } } public function select_row($tbl,$cnd=null){ $sql = "SELECT * FROM ".$tbl; if($cnd!=null){ $sql.=" WHERE ".$cnd; } $result = $this->conn->query($sql); if ($result->num_rows > 0) { return mysqli_fetch_row($result); }else{ return array(); } } public function select_custom($query){ $result = $this->conn->query($query); if ($result->num_rows > 0) { return mysqli_fetch_all($result,MYSQLI_ASSOC); }else{ return array(); } } public function insert($sql){ //$this->conn->query($sql) if ($this->conn->query($sql) === TRUE) { return mysqli_insert_id($this->conn); } } public function delete($sql){ if ($this->conn->query($sql) === TRUE) { return 1; }else{ return 0; } } }