From b0c3919ab19de68b49cc01aa1e80331da08dc76f Mon Sep 17 00:00:00 2001 From: lopar Date: Sat, 31 Mar 2018 17:02:17 +0300 Subject: [PATCH] tests --- admin/test.php | 2 +- classes/showpers.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 classes/showpers.php diff --git a/admin/test.php b/admin/test.php index 8999323..898da7b 100644 --- a/admin/test.php +++ b/admin/test.php @@ -24,7 +24,7 @@ spl_autoload_register(function ($class_name) { $items = []; $res = db::c()->query('SELECT name,img,type,id FROM inventory WHERE owner = 11263 AND dressed = 1'); foreach ($res->fetch_assoc() as $value) { - $items[$value['id']] = $value; + $items[$value['name']] = $value; } print_r($items); diff --git a/classes/showpers.php b/classes/showpers.php new file mode 100644 index 0000000..a58750b --- /dev/null +++ b/classes/showpers.php @@ -0,0 +1,44 @@ + + * Project name: Battles-Game + */ + +class showpers +{ + private $pers_data; + private $weared_items; + + private function __construct($id) + { + if (!$this->pers_data) { + $query = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc(); + $this->pers_data = $query; + } + if (!$this->weared_items) { + $query = db::c()->query('SELECT `name`, `img`, `type` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 1', $id); + $this->weared_items = $query; + } + } + + private function dgfs() + { + $w_items['sergi'] = $this->pers_data['sergi']; + $w_items['kulon'] = $this->pers_data['kulon']; + $w_items['weap'] = $this->pers_data['weap']; + $w_items['bron'] = $this->pers_data['bron']; + $w_items['r1'] = $this->pers_data['r1']; + $w_items['r2'] = $this->pers_data['r2']; + $w_items['r3'] = $this->pers_data['r3']; + $w_items['helm'] = $this->pers_data['helm']; + $w_items['perchi'] = $this->pers_data['perchi']; + $w_items['shit'] = $this->pers_data['shit']; + $w_items['boots'] = $this->pers_data['boots']; + $w_items['rubax'] = $this->pers_data['rubax']; + $w_items['plaw'] = $this->pers_data['plaw']; + $w_items['rune1'] = $this->pers_data['rune1']; + $w_items['rune2'] = $this->pers_data['rune2']; + $w_items['rune3'] = $this->pers_data['rune3']; + } +}