functions.php
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
69
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
69
<?
function classlist($id) {
$sql1 = "SELECT * FROM `class` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `class` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"class\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->class ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->class ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function ranglist($id) {
$sql1 = "SELECT * FROM `rangs` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `rangs` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"sub_class\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->rang ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->rang ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function lokatielist($id) {
$sql1 = "SELECT * FROM `lokaties` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `lokaties` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"lokatie\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list ->lokatie ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list ->lokatie ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function id2location($id) {
$sql = "SELECT * FROM `lokaties` WHERE id = '". $id ."' LIMIT 0,1";
$query = mysql_query( $sql );
while ( $location = mysql_fetch_array( $query ) ){
return $location['lokatie'];
}
}
function rand_str($size) {
$feed = "0123456789abcdefghijklmnopqrstuvwxyz";
for ($i=0; $i < $size; $i++) {
$rand_str .= substr($feed, rand(0, strlen($feed)-1), 1);
}
return $rand_str;
}
function gmtime() { return time() - date('Z'); }
?>
function classlist($id) {
$sql1 = "SELECT * FROM `class` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `class` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"class\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->class ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->class ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function ranglist($id) {
$sql1 = "SELECT * FROM `rangs` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `rangs` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"sub_class\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->rang ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list->id .". ". $list ->rang ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function lokatielist($id) {
$sql1 = "SELECT * FROM `lokaties` WHERE `id` = '". $id ."' LIMIT 1";
$query1 = mysql_query( $sql1 );
$sql2 = "SELECT * FROM `lokaties` WHERE `id` != '". $id ."'";
$query2 = mysql_query( $sql2 );
$menu .= "<select name=\"lokatie\">\n";
while( $list = mysql_fetch_object( $query1 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list ->lokatie ."</option>\n";
}
while( $list = mysql_fetch_object( $query2 ) ) {
$menu .= "<option value=\"". $list->id ."\">". $list ->lokatie ."</option>\n";
}
$menu .= "</select>\n";
return $menu;
}
function id2location($id) {
$sql = "SELECT * FROM `lokaties` WHERE id = '". $id ."' LIMIT 0,1";
$query = mysql_query( $sql );
while ( $location = mysql_fetch_array( $query ) ){
return $location['lokatie'];
}
}
function rand_str($size) {
$feed = "0123456789abcdefghijklmnopqrstuvwxyz";
for ($i=0; $i < $size; $i++) {
$rand_str .= substr($feed, rand(0, strlen($feed)-1), 1);
}
return $rand_str;
}
function gmtime() { return time() - date('Z'); }
?>
en dit is de fout:
Fatal error: Cannot redeclare classlist() (previously declared in /functions.php on line 2
Ik denk dat je deze file 2x include, waardoor die functie 2x wordt gedefined :)
nee doe ik maar 1 keer include
weet iemand anders waar het aan kan liggen?
if(!function_exists('classlist')){
function classlist(){
}
}
webmaster:
nee doe ik maar 1 keer include
Dan bestaat de functie al.
Het lijkt er namelijk op dat je functions.php 2 keer include in hetzelfde script of dat je functions.php via een ander bestand include terwijl je functions.php al hebt geinclude.
edit:
Je kunt om te testen ook even dit bovenin je functions.php bestand zetten:
Code (php)
Gewijzigd op 15/06/2005 18:28:00 door Martijn B