root/dev/common/includes/class.alliance.php @ 317

Revision 192, 1.2 KB (checked in by exi, 16 years ago)

Fixed several potential security issues with unchecked variables.
Added .htaccess files to common/ and mods/.
Modified the sync module to not send item data anymore.

Line 
1<?php
2
3class Alliance
4{
5    function Alliance($id = null)
6    {
7        $this->id_ = $id;
8        $this->qry_ = new DBQuery();
9
10        $this->sql_ = "select * from kb3_alliances where all_id = " . $this->id_;
11    }
12
13    function getID()
14    {
15        return $this->id_;
16    }
17
18    function getUnique()
19    {
20        return preg_replace('/[^a-zA-Z0-9]/', '', $this->getName());
21    }
22
23    function getName()
24    {
25        $this->execQuery();
26        return $this->row_['all_name'];
27    }
28
29    function execQuery()
30    {
31        if (!$this->qry_->executed_)
32        {
33            $this->qry_->execute($this->sql_);
34            $this->row_ = $this->qry_->getRow();
35        }
36    }
37
38    function add($name)
39    {
40        $qry = new DBQuery();
41        $qry->execute("select * from kb3_alliances where all_name = '".slashfix($name)."'");
42
43        if ($qry->recordCount() == 0)
44        {
45            $qry->execute("insert into kb3_alliances (all_id,all_name) values (null,'".slashfix($name)."')");
46            $this->id_ = $qry->getInsertID();
47        }
48        else
49        {
50            $row = $qry->getRow();
51            $this->id_ = $row['all_id'];
52        }
53    }
54}
55?>
Note: See TracBrowser for help on using the browser.