-
Notifications
You must be signed in to change notification settings - Fork 0
/
character.php
42 lines (27 loc) · 1.13 KB
/
character.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
<?php
class character_page extends page {
public function select_action( $id ) {
character::unselect();
if( !account::logged_in() ) {
page::redirect( '/account/not-logged-in' );
}
if( $id ) {
$id = (int)$id;
$q = db::query(
'select count(*) from '.character::table_name().' where id=? and account_id=?',
$id,
account::current()->id
);
$count = $q->fetchColumn( 0 );
if( !$count ) {
//character doesn't exist or this isn't your character, reload
//the character selection (AND DONT TRY TO FUCK WITH ME!)
page::redirect( '/character/select' );
}
character::select( $id );
page::redirect( '/world' );
}
$characters = character::load( account::current()->id, 'account_id' );
$this->set( 'characters', $characters->fetchAll() );
}
}