<?php
include ("../config.inc.php"); //An dieser weiteren Include liegts nicht.
$dummy = ";;;;;;;;;;;";
class Location {
var $id;
var $name;
var $room_nr;
var $directions = array (); //of bool
var $direction_paths = array (); //id array
var $direction_names = array ();
var $quer;
var $koordinaten = array ();
var $door;
var $stockwerk;
var $turn;
var $dummy_names = array ();
var $visits;
// Hab hier schon public vorgeschrieben, bringt auch nix
public function GetProperties ($id,$inc) {
//An
SQL-Codes liegts nicht...
$
query = mysql_query ("SELECT ... FROM ... WHERE id = '$id'");
if (!$
query) {
die ("Error in
SQL-Syntax
".mysql_error ());
}
$r = mysql_fetch_array ($
query);
$this->id = $id;
$this->name = $r[1];
$this->room_nr = $r[2];
$this->quer = $r[5];
$this->directions = explode (";",$r[3]);
$this->direction_paths = explode (";",$r[4]);
$this->door = $r[7];
$this->koordinaten = explode (";",$r[6]);
$this->stockwerk = $r[8];
$this->turn = $r[9];
if (!empty($r[10])) {
$this->dummy_names = explode(";",$r[10]);
} else {
$this->dummy_names = explode(";",$dummy);
}
$this->visits = $r[11]+1;
if ($inc) {
$
handle = fopen ("buffer.dat","r");
$allVisits = fread ($
handle,filesize ("buffer.dat"));
fclose ($
handle);
$allVisits++;
$
handle = fopen ("buffer.dat","w");
fwrite ($
handle,$allVisits);
fclose ($
handle);
mysql_query ("UPDATE ... SET visits = visits+1 WHERE id = '$id'");
}
foreach ($this->direction_paths as $v) {
$
query = NULL;
$
query = mysql_query ("SELECT ... FROM ... WHERE id = '$v'");
if (!$
query) {
die ("Error in
SQL-Syntax
".mysql_error ());
}
$buffer = mysql_fetch_array ($
query);
array_push($this->direction_names,$buffer[0]);
}
}
}
?>