function sql_q($q){ if ($_SESSION['home_dir']){ global $connect; $trace=debug_backtrace(); $file=$trace[0]['file']; $home_dir_length=strlen($_SESSION['home_dir']); $file=substr($file,$home_dir_length+1); $query = iconv("WINDOWS-1251", CONVERT_TO_CHARSET, $q); $res=@mysql_query($query,$connect); if(mysql_error())die(d(mysql_error())); else if(strtoupper(substr(trim($q), 0, 6)) != "SELECT")sql_log($q,$file); return $res; } else d('ИЗТЕКЛА СЕСИЯ!'); }
/** * Method to delete a record from the table. * * @param string $pkfield the name of the primary key field * @param mixed $pkvalue the value of the primary key field for the record to delete * @return TRUE |FALSE TRUE on success, FALSE on failure * @access public */ public function delete($pkfield, $pkvalue, $tablename = '') { if (empty($tablename)) { $tablename = $this->_tableName; } $params = ''; $sql = "DELETE FROM {$tablename} WHERE {$pkfield}='{$pkvalue}'"; if ($this->debug == TRUE) { log_debug($sql); } if ($this->dbLayer === 'MDB2') { if ($this->_db->phptype == 'mysql') { $ret = $this->_execute($sql, $params); } else { $ret = $this->_db->query($sql); } } elseif ($this->dbLayer === 'PDO') { try { $ret = $this->query($sql); } catch (PDOException $e) { throw new customException($e->getMessage()); customException::cleanUp(); exit; } } else { $ret = $this->_db->query($sql); } if ($this->adm == TRUE) { if (!in_array($tablename, $this->nonmirrored)) { sql_log("[SQLDATA]" . $sql . "[/SQLDATA]"); } } if ($this->objMemcache == TRUE) { chisimbacache::getMem()->flush(); } if ($this->objAPC == TRUE) { apc_clear_cache("user"); } return $ret; }