- $x = 0;
- $y = 0;
- if (isset($_SESSION['id'])) {
- $x = $this->player->x;
- $y = $this->player->y;
- $id = $this->player->id;
- } else {
- do {
- $x = rand(0, count($this->universe->rooms)-1);
- $y = rand(0, count($this->universe->rooms[0])-1);
- } while ($this->universe->rooms[$x][$y]['state']);
- $id = $this->insert('INSERT INTO players (name,room) VALUES(?,?)',
- 'si', 'majuscule', $this->universe->rooms[$x][$y]['id']);
- $_SESSION['id'] = $id;
- }
- return array('x' => $x, 'y' => $y, 'id' => $id);
+ $x = $y = 0;
+ do {
+ $x = rand(0, count($this->universe->rooms)-1);
+ $y = rand(0, count($this->universe->rooms[0])-1);
+ } while ($this->universe->rooms[$x][$y]['state']);
+ $id = $this->insert('INSERT INTO players (name,room) VALUES(?,?)',
+ 'si', $_GET['name'], $this->universe->rooms[$x][$y]['id']);
+ $_SESSION['id'] = $id;
+ //$others = $this->query('SELECT id, room FROM players WHERE id != ?', 'i', $this->player->id);
+ return array('x' => $x, 'y' => $y, 'id' => $id, 'name' => $name);