error
Fatal error: Call to a member function on a non-object in /var/www/html/toplist.php on line 8
Dit is het script:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
$path = "http://www.ubc-clan.nl"; //This is the full system path to your paFileDB folder. You will need to obtain this information from a phpinfo.php file, or from your host.
$show = "5"; //How many files do you want to show on the list
$template = "<b>{number}.</b> <a href=\"{filelink}\">{filename} ({info})/a><br>"; //Template for each line.
//Don't modify anything below this line.
require $path. "/includes/mysql.php";
$pafiledb_sql->connect($db);
$config = $pafiledb_sql->query($db,"SELECT * FROM $db[prefix]_settings",1);
switch ($list) {
case newest:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_time DESC LIMIT 0,$show ", 0);
$info = "Added on {date}";
break;
case downloads:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_dls DESC LIMIT 0,$show ", 0);
$info = "{downloads} Downloads";
break;
case rating:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_rating/(file_totalvotes - 0) DESC LIMIT 0,$show", 0);
$info = "{rating}/10 - {votes} Votes";
break;
default:
die("You didn't select the type of list to show. Please see the paFileDB manual for more information");
break;
}
$i = 1;
while ($file = mysql_fetch_object($result)) {
$line = str_replace("{number}", $i, $template);
$line = str_replace("{filelink}", "$config[3]/pafiledb.php?action=file&id=$file->file_id", $line);
$line = str_replace("{filename}", $file->file_name, $line);
if ($list == "newest") { $infoline = str_replace("{date}", date("n/j/y", $file->file_time), $info); }
if ($list == "downloads") {$infoline = str_replace("{downloads}", $file->file_dls , $info); }
if ($list == "rating") {
$ntv = $file->file_totalvotes - 1;
$infoline = str_replace("{rating}", @round($file->file_rating/$ntv,2), $info);
$infoline = str_replace("{votes}", $ntv, $infoline);
}
$line = str_replace("{info}", $infoline, $line);
echo $line;
$i++;
}
?>
$path = "http://www.ubc-clan.nl"; //This is the full system path to your paFileDB folder. You will need to obtain this information from a phpinfo.php file, or from your host.
$show = "5"; //How many files do you want to show on the list
$template = "<b>{number}.</b> <a href=\"{filelink}\">{filename} ({info})/a><br>"; //Template for each line.
//Don't modify anything below this line.
require $path. "/includes/mysql.php";
$pafiledb_sql->connect($db);
$config = $pafiledb_sql->query($db,"SELECT * FROM $db[prefix]_settings",1);
switch ($list) {
case newest:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_time DESC LIMIT 0,$show ", 0);
$info = "Added on {date}";
break;
case downloads:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_dls DESC LIMIT 0,$show ", 0);
$info = "{downloads} Downloads";
break;
case rating:
$result = $pafiledb_sql->query($db, "SELECT * FROM $db[prefix]_files ORDER BY file_rating/(file_totalvotes - 0) DESC LIMIT 0,$show", 0);
$info = "{rating}/10 - {votes} Votes";
break;
default:
die("You didn't select the type of list to show. Please see the paFileDB manual for more information");
break;
}
$i = 1;
while ($file = mysql_fetch_object($result)) {
$line = str_replace("{number}", $i, $template);
$line = str_replace("{filelink}", "$config[3]/pafiledb.php?action=file&id=$file->file_id", $line);
$line = str_replace("{filename}", $file->file_name, $line);
if ($list == "newest") { $infoline = str_replace("{date}", date("n/j/y", $file->file_time), $info); }
if ($list == "downloads") {$infoline = str_replace("{downloads}", $file->file_dls , $info); }
if ($list == "rating") {
$ntv = $file->file_totalvotes - 1;
$infoline = str_replace("{rating}", @round($file->file_rating/$ntv,2), $info);
$infoline = str_replace("{votes}", $ntv, $infoline);
}
$line = str_replace("{info}", $infoline, $line);
echo $line;
$i++;
}
?>
Hoe los ik dit op?
De mysql functie bestaat niet of is incorrect aangeroepen in de class?
hij bestaat wel en ik zou niet weten hoe ik hem verkeerd kan hebben aangeroepen?
Heb je de class wel gedefineerd?
Waarschijnlijk niet ;)
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
paFileDB 3.1
©2001/2002 PHP Arena
Written by Todd
[email protected]
http://www.phparena.net
Keep all copyright links on the script visible
Please read the license included with this script for more information.
*/
/*You need to change these variables to get paFileDB working. If you are unsure of this information, please contact your host to obtain this information*/
$db[host] = "localhost"; //This is the MySQL server paFileDB will connect to
$db[user] = "ubc-clan-nl"; //This is the MySQL user name
$db[pass] = "ubcaamembers"; //This is the MySQL password
$db[name] = "ubc-clan_nl_-_pafiledb"; //This is the MySQL database paFileDB will put it's information in
/*
This is the MySQL table name prefix. The default is "pafiledb" but if you wish to install multiple copies of
paFileDB on the same database, change this to something like "pafiledb2." All tables in the MySQL database will
be named "$prefix_files," "$prefix_license" ect, for example: "pafiledb_files" and "pafiledb2_files." That will
allow multple copies of paFileDB on the same database. If you are only installing one copy of paFileDB, you dont
need to change this. NOTE: Your host does not have this information, it is up to you to set it to what you want.
If you are upgrading from an older version of paFileDB, you MUST keep this as "pafiledb"
*/
$db[prefix] = "pafiledb"; //Table name prefix-explained above.
/*Don't mess with anything below here unless you know what you're doing!*/
class pafiledb_sql {
function query($db,$query,$type) {
$result = mysql_query($query);
$error = mysql_error();
global $query_count;
global $queries_used;
$query_count++;
$queries_used .= "<tr><td width=\"100%\" align=\"left\" class=\"datacell\">$query</td></tr>";
if (!empty($error)) {
$errno = mysql_errno();
$this->error("paFileDB was unable to successfully run a MySQL query.<br>MySQL Returned this error: <b>$error</b> Error number: <b>$errno</b><br>The query that caused this error was: <b>$query</b>");
}
if ($type == 0) {
return $result;
}
if ($type == 1) {
$array = mysql_fetch_array($result);
return $array;
}
if ($type == 2) {
$array = mysql_num_rows($result);
return $array;
}
if ($type == 3) {
$array = mysql_insert_id();
return $array;
}
@mysql_free_result($result);
}
function error($error) {
die($error);
}
function connect($db) {
if(!($dbc = mysql_connect($db[host],$db[user],$db[pass]))) $this->error("paFileDB was unable to successfully connect to the MySQL database. Check your settings including the MySQL server, username, and password and try again.");
if(!(mysql_select_db($db[name],$dbc))) $this->error("paFileDB was able to connect to the MySQL database, but was unable to select the database <b>$db[name]</b> to use.");
}
}
$pafiledb_sql = new pafiledb_sql;
?>
/*
paFileDB 3.1
©2001/2002 PHP Arena
Written by Todd
[email protected]
http://www.phparena.net
Keep all copyright links on the script visible
Please read the license included with this script for more information.
*/
/*You need to change these variables to get paFileDB working. If you are unsure of this information, please contact your host to obtain this information*/
$db[host] = "localhost"; //This is the MySQL server paFileDB will connect to
$db[user] = "ubc-clan-nl"; //This is the MySQL user name
$db[pass] = "ubcaamembers"; //This is the MySQL password
$db[name] = "ubc-clan_nl_-_pafiledb"; //This is the MySQL database paFileDB will put it's information in
/*
This is the MySQL table name prefix. The default is "pafiledb" but if you wish to install multiple copies of
paFileDB on the same database, change this to something like "pafiledb2." All tables in the MySQL database will
be named "$prefix_files," "$prefix_license" ect, for example: "pafiledb_files" and "pafiledb2_files." That will
allow multple copies of paFileDB on the same database. If you are only installing one copy of paFileDB, you dont
need to change this. NOTE: Your host does not have this information, it is up to you to set it to what you want.
If you are upgrading from an older version of paFileDB, you MUST keep this as "pafiledb"
*/
$db[prefix] = "pafiledb"; //Table name prefix-explained above.
/*Don't mess with anything below here unless you know what you're doing!*/
class pafiledb_sql {
function query($db,$query,$type) {
$result = mysql_query($query);
$error = mysql_error();
global $query_count;
global $queries_used;
$query_count++;
$queries_used .= "<tr><td width=\"100%\" align=\"left\" class=\"datacell\">$query</td></tr>";
if (!empty($error)) {
$errno = mysql_errno();
$this->error("paFileDB was unable to successfully run a MySQL query.<br>MySQL Returned this error: <b>$error</b> Error number: <b>$errno</b><br>The query that caused this error was: <b>$query</b>");
}
if ($type == 0) {
return $result;
}
if ($type == 1) {
$array = mysql_fetch_array($result);
return $array;
}
if ($type == 2) {
$array = mysql_num_rows($result);
return $array;
}
if ($type == 3) {
$array = mysql_insert_id();
return $array;
}
@mysql_free_result($result);
}
function error($error) {
die($error);
}
function connect($db) {
if(!($dbc = mysql_connect($db[host],$db[user],$db[pass]))) $this->error("paFileDB was unable to successfully connect to the MySQL database. Check your settings including the MySQL server, username, and password and try again.");
if(!(mysql_select_db($db[name],$dbc))) $this->error("paFileDB was able to connect to the MySQL database, but was unable to select the database <b>$db[name]</b> to use.");
}
}
$pafiledb_sql = new pafiledb_sql;
?>
de class was al gedefineerd
mieschien heb je een typ fout gemaakt ?
ik denk dat die niet goed werd gerequired :)
require ("includes/mysql.php");
en DD wrom ../ ??
omdat die map waarschijnlijk in zn hoofdfolder staat en als dit script dan in een andere map staat kan hij hem toch nog requieren :)
oke ik snap het ;)
dan geeft ie een error van can not open stream
doe dan met include ;)