No wydaje mi się, że w db.class.php ponieważ w błędzie jest pokazane.
<?php
/* =============================================================================
* Copyright 2005-08 nTechnology ©
* http://www.ntechnolgy.pl, All Rights Reserved
*
* Michell Hoduń
*
* www.hodun.info | www.ntechnology.pl
*
*
* contact@ntechnology.pl
* =============================================================================
*/
require_once(dirname( __FILE__ ).'/functions.class.php');
class db extends functions {
function connect($login, $haslo, $baza, $serwer) {
/*
DB Connect function
$login = mysql login
$haslo = mysql password
$baza = mysql database
$serwer = mysql server
*/
$this->connect = mysql_connect($serwer, $login, $haslo) or die("...");
mysql_select_db($baza);
//mysql_query("SET NAMES 'utf8'");
}
function del_chars($s) {
/*
Function for security reason
$s = string
*/
$this->s = $s;
$this->s = htmlspecialchars($s);
$this->s = strip_tags($s);
$this->s = addslashes($s);
return $this->s;
}
function insert_query($q) {
/*
Function for recent searches, auto suggest etc.
$q = input query.
*/
$this->string = $this->del_chars($q);
$this->q_check = mysql_query('SELECT * FROM `szukane` WHERE `nazwa` = "'.$this->string.'"'); // check record.
if(mysql_num_rows($this->q_check)==0) {
mysql_query('INSERT INTO `szukane` VALUES (NULL, "'.$this->string.'", "1")'); // if record not exists, add record
} else {
mysql_query('UPDATE `szukane` SET `ile` = `ile`+1 WHERE `nazwa` = "'.$this->string.'"'); // if record exists set count + 1
}
}
function create_account($login, $haslo, $email) {
/*
Create Account
$login = username
$haslo = password
$email = email address
*/
$this->login = $this->filtr($login);
$this->haslo = md5($haslo);
$this->email = $this->sprawdz_maila($email);
$this->aktualna_data = date('Y-m-d'); // today date
$this->rejestracja = 'INSERT INTO `uzytkownicy` VALUES (NULL, "'.$this->login.'", "'.$this->haslo.'", "'.$this->email.'", "'.$this->aktualna_data.'")';
if(mysql_query($this->rejestracja)) {
$this->wynik = true;
} else {
$this->wynik = false;
}
return $this->wynik;
}
public function toplist($much) {
$this->much = $much;
$this->get_q = mysql_query('SELECT * FROM `ratings` ORDER BY `total_value` DESC LIMIT '.$this->much.'') or die(mysql_error());
while (($this->rating = mysql_fetch_array($this->get_q, MYSQL_NUM))) {
$this->toplist[] = array(
'id' => $this->rating[0]
);
}
return $this->toplist;
}
function games_cats() {
$this->q = mysql_query('SELECT * FROM `games_cat` ORDER BY `cat_name` ASC');
while (($this->kat = mysql_fetch_array($this->q, MYSQL_NUM))) {
$this->kategoria2[] = array(
'id' => $this->kat[0],
'nazwa' => $this->kat[1],
'link' => $this->usun_znaki($this->kat[1]),
);
}
return $this->kategoria2;
}
function last_added_games($int) {
$this->count = $int;
$this->q = mysql_query('SELECT * FROM `games` ORDER BY `id` DESC LIMIT '.$int.'');
while (($this->kat = mysql_fetch_array($this->q, MYSQL_NUM))) {
$this->kategoria[] = array(
'id' => $this->kat[0],
'nazwa' => $this->kat[1],
'cat' => $this->kat[2],
'file_id' => $this->kat[3],
'date' => $this->kat[4],
'uploader' => $this->kat[5],
'link' => $this->usun_znaki($this->kat[1]),
);
}
return $this->kategoria;
}
function count_games_cat($cat, $limit) {
$this->pg_cnt = mysql_num_rows(mysql_query('SELECT * FROM `games` WHERE `cat` = "'.$cat.'"'));
$this->sss = ceil($this->pg_cnt/$limit);
return $this->sss;
}
function games_cat_info($cat) {
$this->game_category = mysql_query('SELECT * FROM `games_cat` WHERE `id` = "'.$cat.'"');
$this->category_res = mysql_fetch_array($this->game_category);
return $this->category_res;
}
function games_cat_list($cat, $page, $limit) {
$this->cat = $cat;
$this->gm_count = mysql_num_rows(mysql_query('SELECT * FROM `games` WHERE `cat` = "'.$this->cat.'"'));
$this->limit = $limit;
$this->page = $page;
$this->gm_pages_amm = ceil($this->gm_count/$limit);
$this->gm_start_page = $limit*$page;
$this->get_list_cat = mysql_query('SELECT * FROM `games` WHERE `cat` = "'.$this->cat.'" ORDER BY `id` DESC LIMIT '.$this->gm_start_page.','.$this->limit.'');
while (($this->mm = mysql_fetch_array($this->get_list_cat, MYSQL_NUM))) {
$this->m1[] = array(
'id' => $this->mm[0],
'nazwa' => $this->mm[1],
'cat' => $this->mm[2],
'file_id' => $this->mm[3],
'date' => $this->mm[4],
'uploader' => $this->mm[5],
'link' => $this->usun_znaki($this->mm[1]),
);
}
return $this->m1;
}
function get_game_info($id) {
$this->id = (int)$id;
$this->get = mysql_query('SELECT * FROM `games` WHERE `id` = "'.$this->id.'" LIMIT 1');
$this->game_info = mysql_fetch_array($this->get);
return $this->game_info;
}
function count_games() {
$this->cnt_qry = mysql_query('SELECT * FROM `games`');
$this->cnt_games = mysql_num_rows($this->cnt_qry);
return $this->cnt_games;
}
function save_mp3_to_db($id, $title, $desc) {
mysql_query('INSERT INTO `mp3_db` VALUES (NULL, "'.$id.'", "'.$title.'", "'.$desc.'")');
}
function save_video_to_db($id, $title, $desc) {
mysql_query('INSERT INTO `video_db` VALUES (NULL, "'.$id.'", "'.$title.'", "'.$desc.'")');
}
function games_top_uploaders() {
$this->get_uploaders = mysql_query('SELECT * FROM `admin`');
while (($this->uploader = mysql_fetch_array($this->get_uploaders, MYSQL_NUM))) {
$this->uploaders[] = array(
'name' => $this->uploader[1],
);
}
$this->nick_count = count($this->uploaders);
$this->count_array = array();
for($this->i=0;$this->i<$this->nick_count;$this->i++) {
$this->count_query = mysql_query('SELECT * FROM `games` WHERE `uploader` = "'.$this->uploaders[$this->i]['name'].'"');
$this->count_array[$this->i]['name'] = $this->uploaders[$this->i]['name'];
$this->count_array[$this->i]['count'] = mysql_num_rows($this->count_query);
}
$this->count_array = $this->record_sort($this->count_array, "count", true);
return $this->count_array;
}
function sitemap($page, $limit) {
$this->gm_count = mysql_num_rows(mysql_query('SELECT * FROM `szukane`'));
$this->limit = $limit;
$this->page = $page;
$this->gm_pages_amm = ceil($this->gm_count/$limit);
$this->gm_start_page = $limit*$page;
$this->sitemapek = mysql_query('SELECT * FROM `szukane` ORDER BY `ile` DESC LIMIT '.$this->gm_start_page.','.$this->limit.'');
while (($this->sitemap = mysql_fetch_array($this->sitemapek, MYSQL_NUM))) {
$this->sitemaps[] = array(
'id' => $this->mm[0],
'nazwa' => $this->sitemap[1],
'count' => $this->sitemap[2],
'link' => $this->usun_znaki($this->sitemap[1]),
);
}
$this->out_arr = array("count" => $this->gm_count, "data" => $this->sitemaps);
return $this->out_arr;
}
}
?>