Revision 1, 1.1 KB
(checked in by andrewgunn, 14 years ago)
|
Added original EVE-Killboard.net source code.
|
Line | |
---|
1 | <? |
---|
2 | require_once( "db.php" ); |
---|
3 | |
---|
4 | class Alliance { |
---|
5 | |
---|
6 | function Alliance( $id = NULL ) |
---|
7 | { |
---|
8 | $this->id_ = $id; |
---|
9 | $this->qry_ = new DBQuery(); |
---|
10 | |
---|
11 | $this->sql_ = "select * |
---|
12 | from kb3_alliances |
---|
13 | where all_id = ".$this->id_; |
---|
14 | } |
---|
15 | |
---|
16 | function getID() |
---|
17 | { |
---|
18 | return $this->id_; |
---|
19 | } |
---|
20 | |
---|
21 | function getName() |
---|
22 | { |
---|
23 | $this->execQuery(); |
---|
24 | return $this->row_['all_name']; |
---|
25 | } |
---|
26 | |
---|
27 | function execQuery() |
---|
28 | { |
---|
29 | if ( !$this->qry_->executed_ ) { |
---|
30 | $this->qry_->execute( $this->sql_ ); |
---|
31 | $this->row_ = $this->qry_->getRow(); |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | function add( $name ) |
---|
36 | { |
---|
37 | $qry = new DBQuery(); |
---|
38 | $qry->execute( "select * |
---|
39 | from kb3_alliances |
---|
40 | where all_name = '".slashfix( $name )."'" ); |
---|
41 | |
---|
42 | if ( $qry->recordCount() == 0 ) { |
---|
43 | $qry->execute( "insert into kb3_alliances values ( null, |
---|
44 | '".slashfix( $name )."', |
---|
45 | 'default' )" ); |
---|
46 | $this->id_ = $qry->getInsertID(); |
---|
47 | } |
---|
48 | else { |
---|
49 | $row = $qry->getRow(); |
---|
50 | $this->id_ = $row['all_id']; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | } |
---|
55 | ?> |
---|